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在这个小时最大的那个数据和时间,最近老是有死锁,不知道为什么,如何修改