Skip to content
Advertisement

Take last hour and group it by 1 minute

I was wondering if you can help me write a query that should just SELECT count(*) but only include data from last hour and group it by minute.

So I have a table that has a createdts so I have the date there. I just want to see how many entries I have in the last hour, but group COUNT(*) per minute.

Advertisement

Answer

DATE_TRUNC() does this:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement