या 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
या 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