select count(id) cnt,datepart(hh,data_time) [Hour]from Table_2 where data_time between '2020-11-26 00:00:00' and '2020-11-26 23:59:59' group by datepart(hh,data_time) ORDER BY [Hour]
id列名,data_time日期列
datepart(hh,data_time),表示以小时分隔,
select count(id) cnt,datepart(hh,data_time) [Hour]from Table_2 where data_time between '2020-11-26 00:00:00' and '2020-11-26 23:59:59' group by datepart(hh,data_time) ORDER BY [Hour]
id列名,data_time日期列
datepart(hh,data_time),表示以小时分隔,