开发中遇到10Min中取一条数据,设备数据是1分钟上传一次
coding….
;With Pit_intrvl_CTE As
(
Select
I.[ColTime]
, DATEPART(MINUTE, I.[ColTime]) Minute
, DATEPART(MINUTE, I.[ColTime])%10 Mod5
, DATEPART(MINUTE, I.[ColTime])- DATEPART(MINUTE, I.[ColTime])%10 Intrv_grp
, I.[FieldValue]
From [KS_DataBase2017].[dbo].[KS_EquipRec20171130] I WHERE I.EquipMentID =1
)
–Select * from Pit_intrvl_CTE order by [ColTime] — shows full results
Select [ColTime],[FieldValue] from Pit_intrvl_CTE where Mod5 = 0 Group by [ColTime],[FieldValue] order by [ColTime]
版权声明:本文为jsboy123原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。