Table t1
a b
--------------- ---------------
1 2
3 2
Table t2
a b
----------------- ---------------
1 1
3 2怎样返回T1表中a=1,b=2这条记录?谢谢!
a b
--------------- ---------------
1 2
3 2
Table t2
a b
----------------- ---------------
1 1
3 2怎样返回T1表中a=1,b=2这条记录?谢谢!
insert into t1 values(1,2)
insert into t1 values(3,2)
create table t2(a int,b int)
insert into t2 values(1,1)
insert into t2 values(3,2)
go
select t1.* from t1,t2 where t1.a = t2.a and t2.a = t2.b
drop table t1,t2/*
a b
----------- -----------
1 2(所影响的行数为 1 行)
*/
insert into #t1 values(3,2) create table #t2(a int,b int) insert into #t2 values(1,1)
insert into #t2 values(3,2)
go
select a.*
from #t1 as a
left join #t2 as b on a.a=b.a and a.b=b.b
where b.a is null or b.b is nulldrop table #t1,#t2
where not exists(select * from T2 where a=t.a and b=t.b) --这个意思?
是这个意思吧
是这个意思吧