Skip to content

Instantly share code, notes, and snippets.

@pablotron
Last active November 2, 2015 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pablotron/fed2481185a2d2edbaf1 to your computer and use it in GitHub Desktop.
Save pablotron/fed2481185a2d2edbaf1 to your computer and use it in GitHub Desktop.
example query
SELECT a.month,
product_id,
COUNT(*) AS num_tickets
FROM (
SELECT to_char(create_date, 'Mon') AS month,
product_id
FROM tickets
) a
GROUP BY a.month, a.product_id
ORDER BY a.month, a.product_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment