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

SQL

AخA
 
WITH RECURSIVE cte (cl_from, cl_type, cl_to) AS
(
    SELECT cl_from, cl_type, cl_to
      FROM categorylinks
      WHERE cl_to = 'Kategorijos' -- starting category
    UNION
    SELECT categorylinks.cl_from, categorylinks.cl_type, categorylinks.cl_to
      FROM cte
      JOIN page
        ON cl_from = page_id
      JOIN categorylinks
        ON page_title = categorylinks.cl_to
      WHERE cte.cl_type = 'subcat' -- subcat addition on each iteration
)
SELECT page_title, cl_from, cl_type, cl_to
FROM cte
JOIN page
  ON cl_from = page_id
WHERE page_namespace = 0
AND page_title = 'Špokaitė'
ORDER BY page_title; -- printing only articles in the end, ordered by title
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...