I have a table with 2628 rows in it. I want to get a count per hour. I have a completion_time
column which tells the date time of per record.
I can find only one-hour count.
select count(*)
from billing b
where b.completion_time >= '2019-04-16 23:50:23'
and b.completion_time <='2019-04-17 00:50:22'
The date time is up to 9 hours. i.e. the process was started at 2016-04-16 23:50:23
and it ends on 2019-04-17 08:16:49
. So I want total counts per hour.
Update 1
I want output like below
How can I achieve it? Any help would be highly appreciated.
group by
clause? – qxg1st hour
,2nd hour
etc is based on which column and with relative to what time ? – Squirrel