热线电话:13121318867

登录
2020-04-29 阅读量: 558
mysql:表子查询 使用别名,还有一个是什么?

引用的字段,必须设置列别名才可以引用,如这里的最高工资

select empno,ename,sal,emp.deptid
from emp
left join (select deptid,max(sal) as 最高工资 from emp group by deptid) as t
on emp.deptid=t.deptid
where sal=最高工资;
21.1614
3
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子