select a.id,a.loc from tb1 a where not exists(select 1 from tb2 b where a.id=b.id and a.loc=b.loc) or exists(select 1 from tb2 b where a.id=b.id and a.loc<>b.loc)
Select tb1.id,tb2.loc From tb1,tb2 Where tb1.id = tb2.id and tb1.loc <> tb2.loc Union Select tb1.id,tb2.loc From tb1,tb2 where not eixst(select a.id from tb2 a where a.id =tb1.id)
where not exists(select 1 from tb2 b where a.id=b.id and a.loc=b.loc)
or exists(select 1 from tb2 b where a.id=b.id and a.loc<>b.loc)
From tb1,tb2
Where tb1.id = tb2.id and tb1.loc <> tb2.loc
Union
Select tb1.id,tb2.loc
From tb1,tb2
where not eixst(select a.id from tb2 a where a.id =tb1.id)