Fork of Empty Categories @ Meta by WhitePhosphorus
This query is marked as a draft This query has been published by لوقا.

SQL

x
 
-- SELECT cat_id, page_id, cat_title, cl_from, cl_to
SELECT page_id as "معرف الصفحة"
, cat_title as "اسم التصنيف"
, GROUP_CONCAT(cl_to SEPARATOR ', ') as "تصنيفات صفحة التصنيف"
FROM category
JOIN page ON cat_title = page_title
JOIN categorylinks ON page_id = cl_from
WHERE cat_pages = 0
AND cat_subcats = 0
AND cat_files = 0
AND page_is_redirect = 0
AND page_namespace = 14
AND cat_id NOT IN (
    SELECT cat_id
    FROM category
    JOIN page ON cat_title = page_title
    JOIN categorylinks ON page_id = cl_from
    WHERE cl_to = 'تحويلات_تصنيفات_ويكيبيديا'
    AND page_is_redirect = 0
    AND page_namespace = 14
)
AND cat_id NOT IN (
    SELECT cat_id
    FROM category
    JOIN page ON cat_title = page_title
    JOIN templatelinks ON page_id = tl_from
    JOIN linktarget ON tl_target_id = lt_id
    WHERE lt_title = "تصنيف_فارغ"
    AND lt_namespace = 10
)
GROUP BY page_id
;
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...