日期:2014-05-19  浏览次数:20497 次

怎样用一句SQL语句,从三张表中取出数据,
我试了半天总是取不出来。
select   a.x,b.x,c.x   from   a,b,c   on   a.x=b.x   and   a.x=c.x


------解决方案--------------------
语句没问题
------解决方案--------------------
select a.x,b.x,c.x from a,b,c where a.x=b.x and a.x=c.x

如果x同名,最好在select 中,对另外两个使用as 为字段取一个别名.
------解决方案--------------------
改where
------解决方案--------------------
我晕,看错了
如果是join的话加on,
不加join的话用where
------解决方案--------------------
select a.x,b.x,c.x
from a inner join b
on a.x=b.x
inner join c
on a.x=c.x
或者

select a.x,b.x,c.x from a,b,c where a.x=b.x and a.x=c.x