This report shows categories that link to stub templates via redirects.
Generated by 14:10, 7 March 2015 (UTC)
First generate the Wikipedia:WikiProject Stub sorting/Uncatted stubs report (using these instructions).
Then:
DROP TABLE IF EXISTS rep3;
CREATE TABLE rep3 AS
SELECT r2.page_title as 'redir', r1.page_title as 'stub'FROM rep1 r1
INNER JOIN rep1 r2 ON r1.page_title = r2.redir
WHERE r1.page_is_redirect = 0
AND r2.page_is_redirect = 1
AND r2.cats > 0;
SELECT concat( '* {{tl|', redir, '}} → {{tl|', stub, '}} is linked from categories: ', group_concat( concat( '{{cl|', page_title, '}}' ) ) )
FROM rep2
INNER JOIN enwiki_p.pagelinks ON pl_from = page_id
INNER JOIN rep3 ON pl_namespace = 10 and pl_title = redir
GROUP BY redir, stub;