共3个表(A表,B表,C表)
A表三个字段(A1,A2,A3)
B表三个字段(B1,B2,B3)
C表三个字段(C1,C2,C3)查询 select A.A1,B.B1 from A,B where A.A2=B.B2 and A.A3=B.B3//列出满足条件A.A1,B.B1
我想要上面查询结果A.A1与C表中C.C1比较,相同的同上面一起列出来,如何写。
非常谢谢

解决方案 »

  1.   

    select * from c,(select A.A1,B.B1 from A,B where A.A2=B.B2 and A.A3=B.B3) t where c.c1=t.a1
      

  2.   

    select 字段,字段 from (
    select A.A1,B.B1 from A,B where A.A2=B.B2 and A.A3=B.B3)tp 
    join c on tp.a1=c.c1
      

  3.   

    select D.*,C1 from (select A.A1,B.B1 from A,B where A.A2=B.B2 and A.A3=B.B3)D,C WHERE D.A1 = C.C1
      

  4.   


    select A.A1,B.B1,C.C1 from A,B,C where A.A2=B.B2 and A.A3=B.B3 AND A.A1=C.C1
    这个意思?
      

  5.   

    c表要什么字段?
    select A.A1,B.B1 from A,B where A.A2=B.B2 and A.A3=B.B3)tp 
    union all
    select 字段,字段 from (
    select A.A1,B.B1 from A,B where A.A2=B.B2 and A.A3=B.B3)tp 
    join c on tp.a1=c.c1 
      

  6.   


    --这样也可以
    select A.A1,c.* 
    from A,B,c 
    where A.A2=B.B2 and A.A3=B.B3 and a.a1=c.c1
      

  7.   

    你们为什么非要把
    select A.A1,B.B1 from A,B where A.A2=B.B2 and A.A3=B.B3
    当成一个表咧?
      

  8.   


    select A.A1,B.B1 from A,B where A.A2=B.B2 and A.A3=B.B3
    left join
    select A.A1,C.C1 from A,C where A.A2=C.C2 and A.A3=C.C3
      

  9.   

    相同的同上面一起列出来
    ---
    要union all
      

  10.   

    select a.*,C1 from (select A.A1,B.B1 from A,B where A.A2=B.B2 and A.A3=B.B3)a,C WHERE a.A1 = C.C1
      

  11.   

    select A.A1,B.B1 from A,B where A.A2=B.B2 and A.A3=B.B3
    union all select A.A1,c.c1 from A,c where A.A1=c.c1