二张表,左连接查询,但右边表里的数据我只要一部,左连接语句怎么写??
全部查询情况:
select * from a left join b where a.id=b.id;b表我只要其中一部:
select * from a left jion (select * from b where b.name like 'aa' as c) where a.id=c.id报错说 as附近有语法错误怎么解决???

解决方案 »

  1.   

    select * from a left jion (select * from b where b.name like 'aa' )as c where a.id=c.id
      

  2.   

    select * from a left jion (select * from b where b.name like 'aa' )as c where a.id=c.id
      

  3.   


    select * from a left join b on (a.id=b.id and b.name like 'aa')
      

  4.   

    或者
    select
      *
    from
      a 
    left join
      b
    on
      a.id=b.id
    where
      b.name like  'aa' 
      

  5.   

    select * from a left join (select * from b where b.name like 'aa' )as c on a.id=c.id
      

  6.   

    参考http://topic.csdn.net/u/20111118/14/2ad406ea-137c-4471-8c0b-384bfd77a6c2.html
      

  7.   

    错误一: jion->join
    错误二: select * from a left join
            (select * from b where b.name like 'aa')  as c on a.id=c.id