使用 datepart(hour,createddate)
select personviews = count(*),datepart(hour,createddate)+1
from Orderswhere createddate between @StartDate and @EndDate
group by datepart(hour,createddate)
order by personviews desc
使用 datepart(hour,createddate)
select personviews = count(*),datepart(hour,createddate)+1
from Orders