I am currently getting all data for yesterday from my database but I want to get data for each hour. This is my query:
select camera_id, count(*) as snapshot_count from snapshots where created_at >= TIMESTAMP 'yesterday' and created_at < TIMESTAMP 'today' group by camera_id
It's giving me all records for yesterday, but how could it be possible to get records from yesterday but for each hour?
PS: I want to run this in one query, not 24 queries