I have two tables. MembID is the only column returned for each. The MembID can be in both tables but I would like to remove the ones that are in both from the results.
I’d like the final return to be 456 and 789 from Table A.
I’ve tried:
x
select distinct a.membid
from a
left join b on a.membid = b.membid
and b.num <> 1
it does not return any results.
Thanks.
Advertisement
Answer
try like below
select distinct a.membid
from a
left join b on a.membid = b.membid
where b.membid is null