求一SQL,各位救命呀.解决就给分.决不含糊.
两个表 temp 和 temp1
temp表结构:
aa bb
1111 1111
1111 2222
1111 3333
1111 4444
2222 1111
2222 2222
2222 3333
2222 4444
3333 1111
3333 2222
3333 3333
3333 4444
create table temp(aa nvarchar(4),bb nvarchar(4))
insert into temp values('1111','1111')
insert into temp values('1111','2222')
insert into temp values('1111','3333')
insert into temp values('1111','4444')
insert into temp values('2222','1111')
insert into temp values('2222','2222')
insert into temp values('2222','3333')
insert into temp values('2222','4444')
insert into temp values('3333','1111')
insert into temp values('3333','2222')
insert into temp values('3333','3333')
insert into temp values('3333','4444')
temp1表结构
cc bb
1111 2222
1111 3333
1111 4444
2222 1111
2222 3333
2222 4444
3333 1111
3333 2222
3333 4444
create table temp1(cc nvarchar(4),dd nvarchar(4))
insert into temp1 values('1111','2222')
insert into temp1 values('1111','3333')
insert into temp1 values('1111','4444')
insert into temp1 values('2222','1111')
insert into temp1 values('2222','3333')
insert into temp1 values('2222','4444')
insert into temp1 values('3333','1111')
insert into temp1 values('3333','2222')
insert into temp1 values('3333','4444')
返回结果:
1111 1111
2222 2222
3333 3333
也就是说通过SQL返回Temp表里有但Temp1表里没有的记录.
如果不清楚题目的可以加我
QQ:29239212
MSN:jeffery_liao@hotmail.com
谢谢各位了!!