Skip to content

Instantly share code, notes, and snippets.

@mesaugat
Last active September 5, 2017 16:58
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 mesaugat/cc37ee934b6cd3725af7df985f69a8e4 to your computer and use it in GitHub Desktop.
Save mesaugat/cc37ee934b6cd3725af7df985f69a8e4 to your computer and use it in GitHub Desktop.
--
-- Most followed users as of March 2017
-- If the user has been unfollowed it still counts as a follow
--
-- https://bigquery.cloud.google.com/savedquery/39178653524:3c9bf26cf2054e50a53d325f869e129a
--
SELECT
u.login AS login,
u.location AS location,
count(f.follower_id) AS num_followers
FROM
[ghtorrent-bq.ght_2017_04_01.users] u
JOIN
[ghtorrent-bq.ght_2017_04_01.followers] f
ON
u.id = f.user_id
WHERE
u.country_code = 'np'
GROUP BY
login,
location
ORDER BY
num_followers DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment