Reputation: 1
hi i'm trying to group the data by hour in big
so how can I group the data by the hour to count the orders per hour?
Upvotes: 0
Views: 325
Reputation: 172974
Use below
select date,
extract(hour from parse_time('%I:%M:%S %p', time)) as hour,
count(distinct order_id) as orders
from your_table
group by date, hour
if applied to sample data in your question - output is
Upvotes: 1