日期:2014-05-18  浏览次数:20453 次

菜鸟求救
我有三各表   a,b,c  
我想从三个表中去数据
select   *   from   a,b,c   where   a.id=b.id   and   c.id=b.id   and   b.id= '0001 '
可是   c   表中可能有时候没有这条数据     我该怎么才能准确的把数据都能准确的取出来       把and   换成or     也是查不出来


------解决方案--------------------
--try

select * from a
left join b on a.id=b.id
left join c on b.id=c.id
where b.id= '0001 '
------解决方案--------------------
select *
from a join b on a.id=b.id
left join c on b.id=c.id
where b.id= '0001 '

------解决方案--------------------
我有三各表 a,b,c
我想从三个表中去数据
select * from a,b,c where a.id=b.id and c.id=b.id and b.id= '0001 '
可是 c 表中可能有时候没有这条数据 我该怎么才能准确的把数据都能准确的取出来 把and 换成or 也是查不出来

select a.*,b.*,c.* from a
left join b on a.id = b.id and b.id = '0001 '
left join c on b.id = c.id