请问怎样查处工资高于所在部门平均工资的员工?谢谢!

解决方案 »

  1.   

    select salary
    from table_salary
    having salary > (select max(salary) from table_salary where department='某部门');
      

  2.   

    哦,需要加group by在from和having之间
      

  3.   

    tt表如下
    name dept salary
    1    1    1000
    2    1    1500
    3    1    2000
    4    1    3000select * from tt where salary>(select avg(salary) from tt)
      

  4.   

    忘了多部门条件
    改为:select a.* from tt a,(select dept,avg(salary) salary from tt group by dept) b where a.salary>b.salary and a.dept=b.dept
      

  5.   

    tong yi lou shang