mysql - Exclude duplicate values in one table and return the remaining -
i have table so:
table: album_image(album_id, image_id) album_id image_id ---------------------------- 87 2326 87 2325 86 2325 85 5689 89 56
having 2 album id's (let's 87 , 86), want extract image_id not in 2 albums.
so, example, if have album_id 87 , 86, should return image_id : 2326
how go doing query?
as per requirement looks need find image either on album_id 86 or 87 not both, , done using group by
, having count
select image_id album_image album_id in (87,86) group image_id having count(*)=1 ;