Skip to content

Instantly share code, notes, and snippets.

@mesaugat
Last active September 5, 2017 16:57
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/6c044f665a77e5756f9b9c6d1fb90889 to your computer and use it in GitHub Desktop.
Save mesaugat/6c044f665a77e5756f9b9c6d1fb90889 to your computer and use it in GitHub Desktop.
--
-- Most unique commits from Jan 2016 to March 2017 for `mesaugat`
-- Change `mesaugat` to any other username to get number of commits for that username
--
-- https://bigquery.cloud.google.com/savedquery/39178653524:9a10947dbf8f429da6dd5193592d2d61
--
SELECT
u.login AS login,
u.location AS location,
u.country_code AS country_code,
COUNT(c.id) AS num_commits
FROM
[ghtorrent-bq.ght_2017_04_01.commits] c
JOIN (
SELECT
login,
location,
country_code,
id
FROM
[ghtorrent-bq.ght_2017_04_01.users]
WHERE
login = 'mesaugat' ) u
ON
c.author_id = u.id,
WHERE
DATE(created_at) BETWEEN DATE('2016-01-01')
AND DATE('2017-04-01')
GROUP BY
login,
location,
country_code
ORDER BY
num_commits DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment