Skip to content

Instantly share code, notes, and snippets.

@zeroeth
Created September 17, 2010 15:27
Show Gist options
  • Save zeroeth/584389 to your computer and use it in GitHub Desktop.
Save zeroeth/584389 to your computer and use it in GitHub Desktop.
SELECT favorites.id, drink_id, count(*) as times
FROM favorizations, favorites
WHERE favorites.id = favorite_id
GROUP BY favorites.id, drink_id
HAVING times > 0
ORDER BY times desc
LIMIT 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment