1、
左联接:select a.*,b.* from tbl1 a left join tbl2 b on a.id=b.id
右联接:select a.*,b.* from tbl1 a right join tbl2 b on a.id=b.id2、select bh,case when bz='rk' then '入库' when bz='ck' then '出库' end as bz,mc from table

解决方案 »

  1.   

    要是偶写滴所要链接滴两个记录集都要有 where 和 order by 应该加在什么位置呢?
      

  2.   


    左联接:select a.*,b.* from tbl1 a left join tbl2 b on a.id=b.id   where  ..  order by ..
    右联接:select a.*,b.* from tbl1 a right join tbl2 b on a.id=b.id  where  ..  order by ..select bh,case when bz='rk' then '入库' when bz='ck' then '出库' end as bz,mc from table
    where  ..  order by ..