SQL
x
USE enwiki_p;
SELECT a.page_id, a.page_title
FROM
(SELECT art2.page_id, art2.page_title
FROM categorylinks cl1
JOIN page tp1
ON (tp1.page_id=cl1.cl_from)
JOIN page art1
ON (tp1.page_title=art1.page_title
AND art1.page_namespace=0)
JOIN redirect
ON (art1.page_namespace=rd_namespace
AND art1.page_title=rd_title)
JOIN page art2
ON (art2.page_id=rd_from)
JOIN page tp2
ON (art2.page_title=tp2.page_title
AND tp2.page_namespace=1)
WHERE cl1.cl_to="All_WikiProject_Medicine_articles"
AND tp1.page_namespace=1
AND art2.page_namespace=0
AND tp2.page_is_redirect=0) AS a
LEFT JOIN
(SELECT art2.page_id, art2.page_title
FROM categorylinks cl1
JOIN page tp1
ON (tp1.page_id=cl1.cl_from)
JOIN page art1
ON (tp1.page_title=art1.page_title
AND art1.page_namespace=0)
JOIN redirect
ON (art1.page_namespace=rd_namespace
AND art1.page_title=rd_title)
JOIN page art2
ON (art2.page_id=rd_from)
JOIN page tp2
ON (art2.page_title=tp2.page_title
AND tp2.page_namespace=1)
JOIN categorylinks cl2
ON (tp2.page_id=cl2.cl_from)
WHERE cl1.cl_to="All_WikiProject_Medicine_articles"
AND cl2.cl_to="All_WikiProject_Medicine_articles"
AND tp1.page_namespace=1
AND art2.page_namespace=0) AS b
USING (page_id)
WHERE b.page_id 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.