Skip to content

Instantly share code, notes, and snippets.

@wonderchook
Created March 19, 2012 10:39
Show Gist options
  • Save wonderchook/2107074 to your computer and use it in GitHub Desktop.
Save wonderchook/2107074 to your computer and use it in GitHub Desktop.
Top Building Mappers
select total, username, rank() OVER(ORDER BY total DESC) from (select count(*) as total, users.name as username from ways INNER JOIN way_tags ON (way_tags.way_id=ways.id) INNER JOIN users ON (users.id=ways.user_id) where way_tags.k='building' GROUP BY users.name ORDER BY total DESC) as answer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment