Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个用于每秒记录值的表
datetime float float 25/02/2013 08:18:56 6 147
我需要创建一个表,上个月每个小时都有一行。
任何帮助表示赞赏。
为什么不直接在表中查询你想要的?
以下查询将返回每小时的第一次读数:
select <columns you want here> from (select t.*, row_number() over (partition by year(datetime), month(datetime), day(datetime), datepart(hour, datetime) ) as seqnum from t ) t where seqnum = 1
您可以将其放入表中,into在select.
into
select