This query is marked as a draft This query has been published by DannyS712.

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.page_title
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.

Checking query status...