SQLServer 每隔10分钟取一条数据

开发中遇到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]

相关文章
相关标签/搜索