SQL
AخA
# Unique human editors and their total edits for a list of articles specified by category, excluding few as may be
SET @pyearbegin=DATE_FORMAT(CURDATE() - INTERVAL 1 YEAR,'%Y-01-01'),
@nyearbegin=DATE_FORMAT(CURDATE() , '%Y-01-01');
SELECT
subqres.user_name,
COUNT(DISTINCT subqres.page_title) as pages_edited,
SUM(subqres.Edits) as tot_edits
FROM(
SELECT page_title,
user_name,
COUNT(*) as Edits
from page
JOIN revision ON page_id = rev_page
JOIN actor ON rev_actor = actor_id
JOIN user ON user_id =actor_user
where rev_actor != 0 AND page_namespace=0
AND LEFT(rev_timestamp,8) >= REPLACE(@pyearbegin,"-","")AND LEFT(rev_timestamp,8) < REPLACE(@nyearbegin,"-","")
AND NOT (user_name LIKE '%AWB%' OR user_name LIKE '%Bot%' OR user_name LIKE'%bot%' OR user_name LIKE '%BOT%' OR user_name ='CommonsDelinker')
AND page.page_title IN
(SELECT page_title
FROM page
JOIN categorylinks ON cl_from = page_id AND cl_to="WikiProject_Andhra_Pradesh_articles" AND cl_type="page")
GROUP BY page_title,user_name
) as subqres
GROUP BY subqres.user_name
HAVING tot_edits >29
ORDER BY tot_edits DESC, pages_edited DESC, user_name ASC
LIMIT 250;
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.