Re: Same field different values



-- Query 1
select Field1
from table1
group by Field1
having sum(case when Field2 not in ('A','B') then 1 else 0 end)=0

-- Query 2
select Field1
from table1
group by Field1
having sum(case when Field2='A' then 1 else 0 end)>0
and sum(case when Field2='B' then 1 else 0 end)>0

.