SQL
x
SET @c = 'American_screenwriters';
SELECT
pg1.page_title,
subs.cl_to
FROM
page AS pg1
JOIN categorylinks AS cl1 ON cl1.cl_from = pg1.page_id
JOIN (
SELECT
cl2.cl_from,
cl2.cl_to
FROM
categorylinks AS cl2
WHERE
cl2.cl_to IN (
SELECT
page_title
FROM
page pg3
JOIN categorylinks AS cl3 ON pg3.page_id = cl3.cl_from
WHERE
cl3.cl_to = @c
AND cl3.cl_type = 'subcat'
)
) AS subs ON subs.cl_from = cl1.cl_from
WHERE
cl1.cl_to = @c
AND cl1.cl_type = 'page'
AND page_namespace = 0
LIMIT 100;
SELECT
pg1.*
FROM
page AS pg1
JOIN categorylinks AS cl1 ON cl1.cl_from = pg1.page_id
JOIN (
SELECT
cl2.cl_from,
cl2.cl_to
FROM
categorylinks AS cl2
WHERE
cl2.cl_to IN (
SELECT
page_title
FROM
page pg3
JOIN categorylinks AS cl3 ON pg3.page_id = cl3.cl_from
WHERE
cl3.cl_to = @c
AND cl3.cl_type = 'subcat'
)
) AS subs ON subs.cl_from = cl1.cl_from
WHERE
cl1.cl_to = @c
AND cl1.cl_type = 'page'
AND page_namespace = 0
LIMIT 100;
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.
Query status: complete
Executed in 0.80 seconds as of Mon, 18 Nov 2019 07:12:42 UTC.