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
DannyS712
.
Toggle Highlighting
SQL
USE enwikinews_p; SELECT CONCAT ( CASE WHEN tl.tl_namespace = 10 THEN 'Template' WHEN tl.tl_namespace = 828 THEN 'Module' ELSE tl.tl_namespace END, ':', tl.tl_title ) AS 'Page', COUNT(*) AS 'Transclusions', CASE WHEN COUNT(*) < 1000 AND MOD(COUNT(*), 100) < 60 THEN CONCAT( SUBSTR(COUNT(*), 1, LENGTH(COUNT(*)) - 2), '00' ) WHEN COUNT(*) < 1000 THEN CONCAT( SUBSTR(COUNT(*), 1, LENGTH(COUNT(*)) - 2), '50' ) WHEN COUNT(*) < 10000 AND MOD(COUNT(*), 100) < 60 THEN CONCAT( SUBSTR(COUNT(*), 1, 1), ',', SUBSTR(COUNT(*), 2, 1), '00' ) WHEN COUNT(*) < 10000 THEN CONCAT( SUBSTR(COUNT(*), 1, 1), ',', SUBSTR(COUNT(*), 2, 1), '50' ) WHEN COUNT(*) < 1000000 AND MOD(COUNT(*), 1000) < 600 THEN CONCAT( SUBSTR(COUNT(*), 1, LENGTH(COUNT(*)) - 3), ',000' ) WHEN COUNT(*) < 1000000 THEN CONCAT( SUBSTR(COUNT(*), 1, LENGTH(COUNT(*)) - 3), ',500' ) ELSE CONCAT( SUBSTR(COUNT(*), 1, 1), '.', SUBSTR(COUNT(*), 2, 1), ' million' ) END AS 'Over', CASE WHEN NOT EXISTS ( SELECT 1 FROM page pg2 WHERE pg2.page_namespace = tl.tl_namespace AND pg2.page_title = CONCAT( tl.tl_title, '/doc/use-count/doc' ) ) THEN '' ELSE CONCAT ( CASE WHEN tl.tl_namespace = 10 THEN 'Template' WHEN tl.tl_namespace = 828 THEN 'Module' ELSE tl.nl_namespace END, ':', tl.tl_title, '/doc/use-count/doc' ) END AS 'Counter' FROM templatelinks tl WHERE tl.tl_namespace IN (10, 828) #GROUP BY CONCAT(tl.tl_title, tl.tl_namespace) HAVING COUNT(*) > 100 ORDER BY 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...