SQL
x
SELECT CONCAT('File:', REPLACE(oi_name, '_', ' ')) AS filename,
COUNT(*) AS 'old versions'
FROM oldimage
JOIN page
ON page_namespace = 6
AND page_title = oi_name
WHERE oi_deleted = 0
AND NOT EXISTS (SELECT 1
FROM categorylinks
WHERE page_id = cl_from
AND cl_to = 'All_non-free_media')
GROUP BY oi_name;
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.