From: Mikael Nordfeldth Date: Thu, 11 Feb 2016 23:05:36 +0000 (+0100) Subject: And LEFT JOIN to actually get all results X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=913595780f0217282754b46b6c24f08676821372;p=quix0rs-gnu-social.git And LEFT JOIN to actually get all results --- diff --git a/scripts/delete_orphan_files.php b/scripts/delete_orphan_files.php index 33293cfb8b..cae35a819f 100755 --- a/scripts/delete_orphan_files.php +++ b/scripts/delete_orphan_files.php @@ -40,7 +40,7 @@ require_once INSTALLDIR.'/scripts/commandline.inc'; print "Finding File entries that are not related to a Notice (or the notice has been deleted)..."; $file = new File(); $sql = 'SELECT file.* FROM file'. - ' JOIN file_to_post ON file_to_post.file_id=file.id'. + ' LEFT JOIN file_to_post ON file_to_post.file_id=file.id'. ' WHERE'. ' NOT EXISTS (SELECT file_to_post.file_id FROM file_to_post WHERE file.id=file_to_post.file_id)'. ' OR NOT EXISTS (SELECT notice.id FROM notice WHERE notice.id=file_to_post.post_id)'.