Fork of Number of orphaned articles by category by Cryptic
This query is marked as a draft This query has been published by Cryptic.

SQL

AخA
 
SELECT cl1.cl_to AS 'Category',
       COUNT(*) AS 'Orphaned articles',
       cat_pages AS 'Total pages'
FROM categorylinks cl1
JOIN categorylinks cl2
  ON cl2.cl_from = cl1.cl_from
     AND cl2.cl_to = 'All_orphaned_articles'
LEFT JOIN category
  ON cat_title = cl1.cl_to
WHERE NOT EXISTS (SELECT 1
                  FROM page_props
                  WHERE pp_page = (SELECT page_id
                                   FROM page
                                   WHERE page_namespace = 14
                                     AND page_title = cl1.cl_to)
                    AND pp_propname = 'hiddencat')
GROUP BY cl1.cl_to, cat_pages
ORDER BY COUNT(*) DESC, cat_pages DESC;
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...