sql分組按時間查詢最近的一條

select t.* from (select * ,row_number() over (partition by FID order by SW_MEASURE_TME desc) as rn from SWLSDTJC) t where rn<=1 and SW_MEASURE_TME > DATEADD(HOUR,-2,GETDATE()) 分組查詢最近兩個小
相關文章
相關標籤/搜索