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
Certes
.
Toggle Highlighting
SQL
SELECT REPLACE(cl_to, "Townships_in_", "") AS State, Pc.page_title AS City, Pt.page_title AS Township FROM categorylinks JOIN page Pt ON Pt.page_id = cl_from AND Pt.page_namespace = 0 AND Pt.page_is_redirect = 0 JOIN page Pc ON Pc.page_namespace = 0 AND Pc.page_title = REGEXP_REPLACE(Pt.page_title, "_Township(,.*County)?", "") AND Pc.page_is_redirect = 0 AND Pc.page_id != Pt.page_id WHERE cl_to LIKE "Townships_in_%" AND cl_to NOT LIKE "Townships_in_%_County%" AND cl_type = 'page' AND NOT EXISTS (SELECT 1 FROM pagelinks WHERE pl_from = Pt.page_id AND pl_namespace = 0 AND pl_title = Pc.page_title) ORDER BY State, City, Township
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...