Fork of
find template redirects
by Jarekt
This query is marked as a draft
This query has been published
by Jarekt.
SQL
x
select p2.page_title, p1.page_title, rd_title, count(tl2.tl_from) as num
from page p1
join linktarget lt1 on lt1.lt_title = p1.page_title and lt1.lt_namespace = 10
join templatelinks tl1 on tl1.tl_target_id = lt1.lt_id
join page p2 on tl1.tl_from = p2.page_id and p2.page_namespace = 10
join linktarget lt2 on lt2.lt_title = p2.page_title and lt2.lt_namespace = 10
join templatelinks tl2 on tl2.tl_target_id = lt2.lt_id
join redirect on rd_from = p1.page_id
where p1.page_namespace = 10 and p1.page_is_redirect = 1
group by p2.page_title
ORDER BY num DESC
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.