HAVING使用子查询

HAVING使用子查询
 
  //查询各部门平均工资,显示平均工资大于
  //公司整体平均工资的记录
  select deptno,avg(sal)
  from emp
  group by deptno
  having avg(sal)>(select avg(sal) from emp);
posted @ 2016-05-16 11:38  YunMan  阅读(880)  评论(0编辑  收藏  举报