select CAST(creationdate as date) AS ForDate, DATEPART(ho...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select CAST(creationdate as date) AS ForDate,
       DATEPART(hour,creationdate) AS OnHour,
       count(*) 
from comments
where creationdate >= Convert(datetime, '2018-04-01' )
GROUP BY CAST(creationdate as date),
       DATEPART(hour,creationdate)
order by CAST(creationdate as date),
       DATEPART(hour,creationdate)

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results