i have mysql query
where have table below(sample data)
employee_id months salary 1 10 200 2 20 300 3 30 400
now wanted find number of employees having maximum total salary (total salary =month * salary)
so have query this
subquery:
((select max(mon_sal.mc) max_mc ( select months*salary mc employee group employee_id) mon_sal) max_mon_sal)
//to find maximum of total salary
now problem need find number of persons having maximum salary,
select max_mon_sal.max_mc,name employee group employee_id having salary=max_mon_sal.max_mc ( (select max(mon_sal.mc) max_mc (select months*salary mc employee group employee_id) mon_sal) max_mon_sal)
its showing error.i have problem using max_mon_sal alias.please suggest.
you can use:
select count(*) employee months * salary = ( select max(months * salary) employee );
Comments
Post a Comment