如题,请问可行吗?

解决方案 »

  1.   

    可以,先left join ,然后在结果集中执行where条件筛选数据
      

  2.   

    但是我不想在where里输入这个条件,因为我想在where里用or语句,用了这个的话我就要在where里混用and和or,这个我不会呢。有解决的办法吗?
      

  3.   

    两张表,a和b,通过字段no相连,a表有字段void,如果void is null,该条记录已删除现在想找到a表中no号码是no1和no2的记录,但是如果其中有记录已经被删除了则不用找出来了怎么表达呢?
      

  4.   

    直接这样不行吗?
    select a.*,b.* from a left join b on a.no=b.no where a.no in('no1','no2') and a.void is not null;
      

  5.   


    select * from yyq_card1 A left join yyq_card2 B on a.SFID = b.SFID where b.SFID = 1
    -------------------------------------------------------------------------------------
    1                  yyq_address1                                                                                         1                  100
    1                  yyq_address1                                                                                         1                  -100
    1                  yyq_address1                                                                                         1                  111
      

  6.   


    select * from yyq_card1 A left join yyq_card2 B on a.SFID = b.SFID  where (b.SFID = 1 or b.SFID = 2) and b.JE is not null
    ----------------------------------------------------------------------------------------------
    1                  yyq_address1                                                                                         1                  100
    1                  yyq_address1                                                                                         1                  111
    1                  yyq_address1                                                                                         1                  -100
    2                  yyq_address2                                                                                         2                  200 --你的这样子行不?
    select * from a left join b on a.id = b.id where (a.no = no1 or a.no = no2) and a.void is not null
      

  7.   

    select a.*,b.* from a left join b on a.no=b.no where a.no in('no1','no2') and a.void is not null;
    应用楼上的,where 肯定可以用在左连接中的
      

  8.   

    如果是连接条件的话,直接写在left join on xxx and xxx就可以了
      

  9.   

    请问11楼,where在left join里怎么用啊
      

  10.   

    select 显示列 from a left join b on a.no=b.no where a.no in(no1,no2)
      

  11.   

    因为要用到on,写where不行,建议嵌套子查询!
      

  12.   

    left join on a.id=b.id and on a.name=b.name and on...
      

  13.   


    可以这样写 select a.*,b.* from a left join b on a.no=b.no and a.no in('no1','no2') and a.void is not null 不需要where 条件 就可以了
      

  14.   

    可以的,两张表连接完成,where后面可以进行筛选的条件