Query for Finding Orphaned files In Drupal


SELECT fm.*
FROM file_managed AS fm
LEFT OUTER JOIN file_usage AS fu ON ( fm.fid = fu.fid )
LEFT OUTER JOIN node AS n ON ( fu.id = n.nid )
WHERE (fu.type = 'node' OR fu.type IS NULL) AND n.nid IS NULL


To view or add a comment, sign in

More articles by Waliullah Khan

Explore content categories