sqlservice 两表之间得到增量数据
select * from (
select max(source_t) source_t,
[name],[sex]
from (
SELECT 1 source_t ,
[name],[sex]
FROM table_1
group by
[name],[sex]
union all
SELECT 2 source_t ,
[name],[sex]
FROM table_2
group by
[name],[sex]
) TB1
group by
[name],[sex]
having count(*)=1
)TB2
where source_t =1