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
Jura1
.
Toggle Highlighting
SQL
# test # See also https://upload.wikimedia.org/wikipedia/commons/f/f7/MediaWiki_1.24.1_database_schema.svg Use wikidatawiki_p; SELECT CURRENT_DATE As updated; SELECT CONCAT('Q',ips_item_id) as qid, CONCAT('<tr><td>{{Q|', ips_item_id, '}} <td> {{#property:P31|from=Q', ips_item_id, '}} <td> {{#property:P1317|from=Q', ips_item_id, '}} <td> ', COUNT(ips_site_id), '</tr>') As '<table class="wikitable sortable"><tr><th>Item <th>{{P|31}} <th>{{P|1317}} <th>Sitelinks</tr>' FROM pagelinks AS pl1, pagelinks AS pl2, wb_items_per_site, wb_entity_per_page WHERE pl1.pl_from_namespace=0 AND pl1.pl_namespace=120 AND pl1.pl_title='P21' AND pl2.pl_from_namespace=0 AND pl2.pl_namespace=0 AND pl2.pl_title='Q5' AND pl1.pl_from NOT IN (SELECT pl_from FROM wikidatawiki_p.page JOIN wikidatawiki_p.pagelinks ON page_id=pl_from WHERE pl_title = "P569" AND pl_namespace = 120) AND pl1.pl_from NOT IN (SELECT pl_from FROM wikidatawiki_p.page JOIN wikidatawiki_p.pagelinks ON page_id=pl_from WHERE pl_title = "P570" AND pl_namespace = 120) AND epp_page_id = pl1.pl_from AND pl1.pl_from = pl2.pl_from AND epp_entity_id = ips_item_id GROUP BY pl1.pl_from HAVING COUNT(ips_site_id) >3 ORDER BY COUNT(ips_site_id) DESC LIMIT 2000
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...