Skip to content

Instantly share code, notes, and snippets.

@jpadilla
Created February 18, 2012 14:25
Show Gist options
  • Save jpadilla/1859541 to your computer and use it in GitHub Desktop.
Save jpadilla/1859541 to your computer and use it in GitHub Desktop.
SELECT DISTINCT main_venue.*,
COUNT(main_like.id) AS likes
FROM main_venue
JOIN main_like ON main_like.venue_id = main_venue.id
GROUP BY main_venue.id
ORDER BY likes DESC
LIMIT 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment