例2:   表A记录如下:
aID               aNum
1                  a20050111
2                  a20050112
3                  a20050113
4                  a20050114
5                  a20050115
表B记录如下:
bID               bName
1                   2006032401
2                  2006032402
3                  2006032403
4                  2006032404
8                  2006032408语句:select * from A left join B on A.aID = B.bID where A.aID=a20050111 AND B.bID=1;
上面的语句如何实现即使B表的查询条件不成立,也显示A表的数据呢
aID               aNum                          bID                  bName
1                   a20050111                                    

解决方案 »

  1.   

    select * from A left join B on A.aID = B.bID where A.aID=a20050111 AND B.bID(+)=1
      

  2.   

    select * from a left join (select * from b where bid=1) c on aid=c.bid where anum='a20050111';
      

  3.   

    select * from A left join B on A.aID = B.bID and B.bID=1 where A.aID=a20050111
      

  4.   

    select * from a left join (select * from b where bid=1) c on aid=c.bid where anum='a20050111'; 
      

  5.   

    select * from A ,(select* from B where bid=1 ) d where where A.aID = d.bID(+)