Skip to Content

Here’s an example:

try drop table #tb1; catch all end try;

try drop table #tb2; catch all end try;

create table #tb1(id integer, test char(20));

create table #tb2(id integer, test char(20));

insert into #tb1(id, test) values(1,’a’);

insert into #tb1(id, test) values(2,’a’);

insert into #tb1(id, test) values(3,’a’);

insert into #tb1(id, test) values(4,’a’);

insert into #tb2(id, test) values(1,’a’);

insert into #tb2(id, test) values(2,’b’);

insert into #tb2(id, test) values(3,’b’);

insert into #tb2(id, test) values(4,’a’);

select a.id, a.test, b.id, b.test

from #tb1 a

full outer join #tb2 b on a.id=b.id and a.test=b.test

where a.id is null or b.id is null

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply