Created
July 8, 2022 17:20
-
-
Save cloverink/4b4d160bdd48540178abd652138e6c7a to your computer and use it in GitHub Desktop.
How to Group by Time in PostgreSQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
date_trunc('minute', created_at), -- or hour, day, week, month, year | |
count(1) | |
from users | |
group by 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment