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

SQL

AخA
 
SELECT CONCAT('[[', CASE t.page_namespace
                      WHEN 10 THEN 'Template:'
                      WHEN 14 THEN ':Category:'
                      ELSE CONCAT('{{ns:', t.page_namespace, '}}:')
                    END, t.page_title, ']]') AS 'redir_to',
       CONCAT('[[', CASE r.page_namespace
                      WHEN 0 THEN ':'
                      WHEN 2 THEN 'User:'
                      WHEN 4 THEN 'Wikipedia:'
                      WHEN 10 THEN 'Template:'
                      WHEN 12 THEN 'Help:'
                      ELSE CONCAT('{{ns:', r.page_namespace, '}}:')
                    END, r.page_title, ']]') AS 'redir_from'
FROM page t
LEFT JOIN redirect ON t.page_namespace = rd_namespace
                  AND t.page_title = rd_title
LEFT JOIN page r ON r.page_id = rd_from
JOIN categorylinks ON t.page_id = cl_from
WHERE cl_to = 'Redirect_templates'
ORDER BY redir_to, redir_from;
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...