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
Mr. Ibrahem
.
Toggle Highlighting
SQL
SELECT main.page_title AS portal_name, COUNT(p.page_title) - 1 AS sub_page_count, COUNT(pl.pl_title) AS links_count FROM page AS p INNER JOIN page AS main ON main.page_title = SUBSTRING_INDEX(p.page_title, '/', 1) LEFT JOIN pagelinks AS pl ON pl.pl_title = main.page_title AND pl.pl_from_namespace = 0 AND pl.pl_namespace = 100 WHERE p.page_namespace = 100 AND main.page_namespace = 100 AND main.page_is_redirect = 0 GROUP BY portal_name ORDER BY links_count DESC;
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...