select t1.* from t1 , t2 where t1.a1 = t2.b1 and t1.a3 = t2.b2

解决方案 »

  1.   

    select t1.* from t1 ,t2 where t1.A1=t2.B1 and t1.A3=t2.B2
      

  2.   

    select 
      *
    from T1,T2
    where t1.a1=t2.b1 and t1.a3=t2.b2
    ?
      

  3.   

    或:select * from t1 where exists(select 1 from t2 where B1=t1.A1 and B2=t1.A3)
      

  4.   

    select a.* from
    t1 a inner join t2 b
    on a.a1=b.b1 and a.a3=b.b2
      

  5.   

    create table T1(A1 varchar(10),A2 varchar(10),A3 int,A4 int)
    insert into t1 values('a' , 'aa', 1 , 11) 
    insert into t1 values('b' , 'bb', 2 , 22) 
    insert into t1 values('c' , 'cc', 3 , 33) 
    insert into t1 values('d' , 'aa', 2 , 44) 
    insert into t1 values('e' , 'dd', 1 , 55) 
    create table T2(B1 varchar(10), B2 int)
    insert into t2 values('a' ,   1 )
    insert into t2 values('b' ,   2 )
    insert into t2 values('c' ,   3 )
    insert into t2 values('d' ,   4 )
    insert into t2 values('e' ,   5 )select t1.* from t1 , t2 where t1.a1 = t2.b1 and t1.a3 = t2.b2
    drop table t1 , t2/*A1         A2         A3          A4          
    ---------- ---------- ----------- ----------- 
    a          aa         1           11
    b          bb         2           22
    c          cc         3           33(所影响的行数为 3 行)
    */
      

  6.   

    select T1.* from T1 inner join T2 on T1.A1=T2.B1 and T1.A3=T2.B2