Time Bands

Database

Time Bands

I have a database that is updated thousands of times a day with customer intractions. Each interaction is recorded as a Time variable over the 24 hour period, and is in the format 00:00:00.

I want to count the number of customers who fall into each hour during the day (i.e. 00:00:00 - 00:59:99) = 12 - 1am.

I have been trying to use the CASE statement to create the banding, but it does not seem to like the aggregated count of customers.

Any ideas.
1 REPLY
Senior Apprentice

Re: Time Bands

select extract(hour from timecol), count(*)
from tab
group by 1?

Dieter