This query is marked as a draft This query has been published by Wbm1058.

SQL

AخA
 
WITH items as (
    SELECT page_title, log_timestamp, comment_text, actor_name
    FROM page
    JOIN page_restrictions ON page_id = pr_page 
        AND pr_type = 'edit' 
        AND pr_level = 'autoconfirmed' 
        AND pr_expiry = 'infinity'
    LEFT JOIN logging_logindex ON log_namespace = page_namespace AND log_title = page_title 
        AND log_type = 'protect' 
        AND log_action != 'move_prot'
    LEFT JOIN comment_logging ON log_comment_id = comment_id
    LEFT JOIN actor_logging ON log_actor = actor_id
    WHERE page_namespace = 0
    AND page_is_redirect = 0
)
SELECT
   t1.page_title AS Article,
   t1.actor_name AS Protector,
   DATE_FORMAT(t1.log_timestamp, '%Y-%m-%d') AS Date,
   t1.comment_text AS Reason
FROM items t1
LEFT JOIN items t2 ON t1.page_title = t2.page_title AND t1.log_timestamp < t2.log_timestamp
WHERE t2.log_timestamp IS NULL
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.

Checking query status...