I am using PostgreSQL database, I have the requirement where I have to provide statistical data for the configurable timespan. I have pasted the sample data of my table.
**id timeStamp caseId**
224 2017-05-30 12:47:27 4654
226 2017-05-30 1:59:46 5165
225 2017-05-30 1:53:31 4658
223 2017-05-30 2:44:45 4656
221 2017-05-30 4:05:53 4645
220 2017-05-30 6:05:12 4640
if the time span is 1 hour then, I want the count records for each hour like [1,2,1,0,1,0,1] and so on...
I can do that using 12 different query with start and end date. but I want the output in one query.
Is it possible in one query.?