select id,name--,COUNT(*)from(select id,name from table1 union all select id,name from table2) xgroup by id,namehaving COUNT(*)=1

select id,name--,COUNT(*)from(select id,name from table1 union all select id,name from table2) xgroup by id,namehaving COUNT(*)=1