after using the extract function to extract an hour value from a timestamp in postgresql, how can I count the number of times each value appears? I'm trying to produce the number of calls coming into a helpdesk based on time of day. So I need to be able to count the number that came in at 2pm, 3pm, 4pm and so on. Thanks for any help.
Asked
Active
Viewed 37 times
0
-
Please update with the schema you are querying and the SQL you have already tried. – wmorrell Jul 24 '17 at 06:23
-
1select count(extract(hour from timestamp_column)), extract(hour from timestamp_column) from your_table group by extract(hour from timestamp_column) – Fahad Anjum Jul 24 '17 at 06:39
-
Thank you Fahad that is exactly what I was looking for. – Slim84 Jul 24 '17 at 17:18