三个表a b c
a.区分='3'
b.成品版本号 is not null
c.开始有效日 is null
关联条件
b.商品货号= a.货号
b.商品货号= c.成品货号
b.成品版本号=c.开始有效日 
以b表为基准 关联a c表 用左关联急求

解决方案 »

  1.   

    ?这样吗
    select * 
    from b 
    left join a on b.商品货号= a.货号
    left join c on b.商品货号= c.成品货号 and b.成品版本号=c.开始有效日 
    where a.区分='3' and b.成品版本号 is not null and c.开始有效日 is null
      

  2.   

    三个表a b c
    a.区分='3'
    b.成品版本号 is not null
    c.开始有效日 is null
    关联条件
    b.商品货号= a.货号
    b.商品货号= c.成品货号
    b.成品版本号=c.开始有效日 
    以b表为基准 关联a c表 用左关联
    RE:
    select * from a,b,c
    where b.商品货号= a.货号
    and b.商品货号= c.成品货号
    and b.成品版本号=c.开始有效日 
    and a.区分='3' 
    and isnull(b.成品版本号,'')<>''
    and isnull(c.开始有效日,'')=''
    要存在表之间的数据不一致就用left join 或full join 进行关联