Fork of Most active users by edits on ruwikinews in last 12 months by MGA73
This query is marked as a draft This query has been published by MGA73.

SQL

x
 
SELECT 
    CONCAT("[[user:", actor_name, "|", actor_name, "]]") AS rev_user_text,
    user_editcount AS total_edits,
    SUM(CASE WHEN rev_timestamp BETWEEN DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 YEAR), '%Y%m%d000000') 
                        AND DATE_FORMAT(NOW(), '%Y%m%d235959') THEN 1 ELSE 0 END) AS edits_last_year,
    SUM(CASE WHEN rev_timestamp BETWEEN DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 MONTH), '%Y%m%d000000') 
                        AND DATE_FORMAT(NOW(), '%Y%m%d235959') THEN 1 ELSE 0 END) AS edits_last_month
FROM revision 
JOIN actor ON rev_actor = actor_id 
JOIN page ON rev_page = page_id 
JOIN user ON actor_user = user_id 
WHERE page_namespace = 0 
    AND actor_user IS NOT NULL 
    AND rev_timestamp BETWEEN DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 YEAR), '%Y%m%d000000') 
                           AND DATE_FORMAT(NOW(), '%Y%m%d235959')
GROUP BY actor_id, user_editcount 
ORDER BY total_edits DESC 
LIMIT 500;
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.

Query status: complete

Executed in 0.56 seconds as of Wed, 26 Mar 2025 07:05:49 UTC.