Skip to content

Instantly share code, notes, and snippets.

@atopal
Last active August 2, 2016 14:22
Show Gist options
  • Save atopal/eaedf01a02862db6a991fd870305bc73 to your computer and use it in GitHub Desktop.
Save atopal/eaedf01a02862db6a991fd870305bc73 to your computer and use it in GitHub Desktop.
Number of Persona active accounts without Github auth
SELECT count(*)
FROM
(SELECT *
FROM `socialaccount_socialaccount`
WHERE `socialaccount_socialaccount`.`provider`="persona") A
LEFT JOIN
(SELECT *
FROM `socialaccount_socialaccount`
WHERE `socialaccount_socialaccount`.`provider`="github") B
ON A.`user_id` = B.`user_id`
JOIN `auth_user` ON `auth_user`.`id` = A.`user_id`
WHERE B.`user_id` IS NULL
AND `auth_user`.`is_active` = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment