Skip to content

Instantly share code, notes, and snippets.

@teich
Created December 18, 2014 00:58
Show Gist options
  • Save teich/6b038ac63c272f771644 to your computer and use it in GitHub Desktop.
Save teich/6b038ac63c272f771644 to your computer and use it in GitHub Desktop.
SELECT
DATE_TRUNC('week', timestamp))::date as week,
COUNT(*)
FROM whatever
GROUP BY week
ORDER BY week asc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment