如果我还要对table1进行条件筛选,然后再和table2得出table3又怎样写?

解决方案 »

  1.   

    select t1.a, t1.b, t1.c, t2.e from table1 t1 inner join table2 t2 on t1.b = t2.c
    如果是用inner join 的话,条件直接放在on里就行
    比如要限制table1的a=2,那么在原来的基础上,在加上 and t1.a = 2这个条件就可以了
    当然条件也可以加在where里
      

  2.   

    table3
    a   b   c  e
    1   4   5  8
    2   3   9  5 
    4   3   8  5
    5   7   6  4
    数据不对吧,e的第四个数据4如何来的?
      

  3.   

    select t1.a ,t1.b,t1.c ,t2.e
    from table1 t1 inner join table2 t2 on t1.b = t2.c
    where .....
      

  4.   

    select t1.a,t1.b,t1.c,t2.efrom table1 as t1left join table2 as t2 on t1.b=t2.cwhere ...