Advertisement
kjetilk

Query returning images with lost tags

Sep 14th, 2017
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.49 KB | None | 0 0
  1. SELECT DISTINCT Images.id,Images.name,filesize,Albums.relativePath FROM Images JOIN Albums ON (Albums.id = Images.album) WHERE Images.id NOT IN (SELECT imageid FROM ImageTags) AND Images.album IS NOT NULL AND Images.status = 1 AND (Images.fileSize IN (SELECT DISTINCT fileSize FROM ImageTags JOIN Images ON (ImageTags.imageid = Images.id) WHERE Images.album IS NULL) AND name IN (SELECT DISTINCT Images.name FROM ImageTags JOIN Images ON (ImageTags.imageid = Images.id) WHERE Images.album IS NULL));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement