Last active
August 29, 2015 14:14
-
-
Save hoosteeno/bb11f1b0ac8032b07ec9 to your computer and use it in GitHub Desktop.
get profile_url, url, count of revisions and bio from mdn profiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
url, count(wiki_revision.id) as revision_count, bio, | |
concat('https://developer.mozilla.org/en-US/profiles/', username) as profile_page | |
from | |
(select substring( | |
misc | |
from ( | |
/* start substring after but not including website key */ | |
locate('"website": ', misc) + 12 | |
) | |
for ( | |
/* the location of the first " after the website key... */ | |
locate('"', misc, locate('"website": ', misc) + 12) | |
/* minus the location of the website key plus the length of the website key */ | |
- (locate('"website": ', misc) + 12) | |
) | |
) | |
as url, | |
user_profiles.bio, | |
auth_user.username, | |
user_profiles.user_id | |
from user_profiles, auth_user | |
where user_profiles.user_id = auth_user.id | |
and misc is not null | |
and misc REGEXP '"website": ' | |
order by auth_user.username asc) | |
as websites | |
left outer join wiki_revision on wiki_revision.creator_id = websites.user_id | |
group by websites.user_id | |
order by websites.username |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment