This query is marked as a draft This query has been published by Hgzh.

SQL

AخA
 
SELECT ltd.lt_title AS title, COUNT(pld.pl_from) AS count
FROM pagelinks pld
INNER JOIN linktarget ltd ON (pld.pl_target_id = ltd.lt_id)
INNER JOIN page pd ON (pd.page_title = ltd.lt_title AND pd.page_namespace = ltd.lt_namespace)
LEFT JOIN page ps ON (ps.page_id = pld.pl_from)
LEFT JOIN linktarget lts ON (lts.lt_title = ps.page_title AND lts.lt_namespace = 0)
LEFT JOIN pagelinks pls ON (pls.pl_target_id = lts.lt_id AND pls.pl_from_namespace = 0 AND ps.page_is_redirect = 1)
LEFT JOIN page plsp ON (plsp.page_id = pls.pl_from)
INNER JOIN page_props ppd ON (ppd.pp_page = pd.page_id AND ppd.pp_propname = 'disambiguation')
WHERE ltd.lt_namespace = 0
AND pld.pl_from_namespace = 0
AND NOT EXISTS(
  SELECT pps.pp_page
  FROM page_props pps
  WHERE (pps.pp_page = ps.page_id)
  AND pps.pp_propname = 'disambiguation'
)
AND NOT EXISTS(
  SELECT pps.pp_page
  FROM page_props pps
  WHERE (pps.pp_page = plsp.page_id)
  AND pps.pp_propname = 'disambiguation'
)
GROUP BY ltd.lt_title
ORDER BY COUNT(pld.pl_from) DESC, ltd.lt_title
LIMIT 200
By running queries you agree to the Cloud Services Terms of Use and you irrevocably agree to release your SQL under CC0 License.
All SQL code is licensed under CC0 License.

Checking query status...