连接的语法是否比使用逗号更严格?

时间:2013-07-07 16:50:35

标签: mysql sql join where

以下查询无法解析:

select t.ename, t.received, d.loc from  
(  
  select e.ename, eb.received , e.deptno  
  from emp e left outer join  emp_bonus eb  
  on  
  e.empno=eb.empno  
)  
as t  
join dept as d on d.deptno = t.deptno;  

错误:

  

字段列表中的列'deptno'不明确

此查询已成功解析:

select t.ename, t.received, d.loc from  
(  
  select e.ename, eb.received , e.deptno  
  from emp e left outer join  emp_bonus eb  
  on  
  e.empno=eb.empno  
)  
as t, dept as d where d.deptno = t.deptno   

我只将JOIN ON更改为t, dept where
为什么第一个版本失败了?

1 个答案:

答案 0 :(得分:1)

第一个查询在mysql 5.1版中运行完美 see the demo