So i have this table A:
color ID MODEL ----------------------------- red | 10 | HONDA blue | 10 | TOYOTA red | 15 |
or using an anti join
anti join
select t1.color, t1.id from tableA t1 left outer join tableA t2 on t2.id = t1.id and t2.color != t1.color where t1.color in ('red', 'blue') and t2.color is null