dqlstp 2015-07-20 02:49 采纳率: 0%
浏览 1540

我这个sql语句会产生阻塞甚至死锁,请高手看看啦,sql2000

select top 1 RelHumi, ydatetime

from [zsqxdb].[dbo].[YCZ_Minutes_Data_New]
where RelHumi =(
SELECT max(RelHumi) FROM [zsqxdb].[dbo].[YCZ_Minutes_Data_New]
where (year(ydatetime)=year(getdate()))
and (month(ydatetime)=month(getdate()))
and (day(ydatetime)=day(getdate()))
and (datename(HH,ydatetime)=datename(HH,getdate()))
)
and (year(ydatetime)=year(getdate()))
and (month(ydatetime)=month(getdate()))
and (day(ydatetime)=day(getdate()))
and (datename(HH,ydatetime)=datename(HH,getdate()))

就是查询RelHumi在这个小时最大的那个数据和时间,最近老是有死锁,不知道为什么,如何修改

  • 写回答

1条回答

  • fang2020 2015-07-20 07:36
    关注

    SELECT top 1 max(RelHumi) as RelHumi, ydatetime FROM [zsqxdb].[dbo].[YCZ_Minutes_Data_New]
    where (year(ydatetime)=year(getdate()))
    and (month(ydatetime)=month(getdate()))
    and (day(ydatetime)=day(getdate()))
    and (datename(HH,ydatetime)=datename(HH,getdate()))

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料