Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
This query is marked as a draft
This query has been published
by
Chriswolfram
.
Toggle Highlighting
SQL
WITH edges AS ( SELECT cl_from AS ref_child_id, page_id AS ref_parent_id FROM categorylinks INNER JOIN page ON cl_to=page_title AND page_namespace=14 ), edges_2 AS ( SELECT edges.ref_child_id AS ref_child_id, e2.ref_parent_id AS ref_parent_id FROM edges, edges e2 WHERE edges.ref_parent_id = e2.ref_child_id ), edges_3 AS ( SELECT edges.ref_child_id AS ref_child_id, edges_2.ref_parent_id AS ref_parent_id FROM edges, edges_2 WHERE edges.ref_parent_id = edges_2.ref_child_id ), edges_4 AS ( SELECT edges.ref_child_id AS ref_child_id, edges_3.ref_parent_id AS ref_parent_id FROM edges, edges_3 WHERE edges.ref_parent_id = edges_3.ref_child_id ), edges_5 AS ( SELECT edges.ref_child_id AS ref_child_id, edges_4.ref_parent_id AS ref_parent_id FROM edges, edges_4 WHERE edges.ref_parent_id = edges_4.ref_child_id ) SELECT ref_child_id, 1 AS depth FROM edges WHERE ref_parent_id=692318 UNION SELECT ref_child_id, 2 AS depth FROM edges_2 WHERE ref_parent_id=692318 UNION SELECT ref_child_id, 3 AS depth FROM edges_3 WHERE ref_parent_id=692318 UNION SELECT ref_child_id, 4 AS depth FROM edges_4 WHERE ref_parent_id=692318 UNION SELECT ref_child_id, 5 AS depth FROM edges_5 WHERE ref_parent_id=692318
By running queries you agree to the
Cloud Services Terms of Use
and you irrevocably agree to release your SQL under
CC0 License
.
Submit Query
Stop Query
All SQL code is licensed under
CC0 License
.
Checking query status...