Fork of
Admins w/ <100 edits since 2018
by Cryptic
This query is marked as a draft
This query has been published
by Cryptic.
SQL
x
SELECT user_name, SUM(rev_ids) AS `live`, SUM(ar_ids) AS `deleted`, SUM(rev_ids + ar_ids) AS `total`
FROM
(
SELECT user_name, COUNT(rev_id) AS `rev_ids`, 0 AS `ar_ids`
FROM user
JOIN user_groups ON ug_user = user_id
JOIN actor_revision ON actor_user = user_id
JOIN revision_userindex ON rev_actor = actor_id
WHERE ug_group = 'sysop'
AND rev_timestamp >= '2018'
GROUP BY user_name
UNION
SELECT user_name, 0, COUNT(ar_id)
FROM user
JOIN user_groups ON ug_user = user_id
JOIN actor_archive ON actor_user = user_id
JOIN archive_userindex ON ar_actor = actor_id
WHERE ug_group = 'sysop'
AND ar_timestamp >= '2018'
GROUP BY user_name
) sq
GROUP BY user_name
HAVING `total` < 100
ORDER BY `total` ASC;
By running queries you agree to the Cloud Services Terms of Use and you irrevocably agree to release your SQL under CC0 License.
All SQL code is licensed under CC0 License.