如何用SQL统计每半小时内某个表的新增记录数? 下面是每一个小时的语句。 SELECT CONVERT(VARCHAR(10),createdate,120) AS 日期 ,DATEPART(hh,createdate) AS 小时,COUNT(*)AS 记录 FROM transactionlog where CreateDate>=@date1+' 00:00:00' and createdate<=@date2+' 23:59:59' GROUP BY CONVERT(VARCHAR(10),createdate,120),DATEPART(hh,createdate) order by 小时