SQL
AخA
SELECT p1.page_title, GROUP_CONCAT(pl_title SEPARATOR ', '), COUNT(pl_title) as links
-- COUNT(distinct IF(p2.page_is_redirect = 1, rd_title, p2.page_title)) as links
FROM page p1 LEFT JOIN pagelinks ON pl_from = p1.page_id AND pl_namespace = 0
JOIN page p2 on pl_title = p2.page_title and p2.page_namespace = 0 and p2.page_title not like 'MOS:%'
LEFT JOIN redirect on p2.page_id = rd_from -- and rd_namespace = 0
/*
AND pl_title IN (
select p2.page_title from page p2
where p2.page_namespace = 0 and p2.page_title not like 'MOS:%'
-- and p2.page_title not like '%\_(disambiguation)'
)
*/
WHERE p1.page_id IN (
select cl_from from categorylinks
where cl_to in ("All_disambiguation_pages"/*, "All_set_index_articles"*/) and cl_type = 'page'
)
AND p1.page_namespace = 0 AND p1.page_is_redirect = 0
AND p1.page_title not like 'MOS:%'
AND p1.page_id not in (
select tl_from from templatelinks where tl_target_id in (
select lt_id from linktarget where lt_title = 'One_other_topic' and lt_namespace = 10
)
)
AND (p2.page_is_redirect = 0 or rd_namespace = 0)
/*
and p1.page_id in (
select rev_page from revision
join actor_revision on actor_id = rev_actor
where rev_id = p1.page_latest
and (actor_user is null or actor_user in (
select user_id from user where user_editcount < 10
))
)
*/
GROUP BY p1.page_title
-- HAVING p1.page_title LIKE '%\_(disambiguation)' AND links < 2 OR links < 1
HAVING p1.page_title LIKE '%\_(disambiguation)' AND links < 3
ORDER BY links
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.