Oracle SQL Forum
Could you please help me to get the highest salary of each department. If multiple employees having the highest salary in the same department then I need the get oldest employee details(who joined first in the company).
Thanks in advance!
select * from (select ename,deptno,sal,hiredate,dense_rank() over(partition by deptno order by sal desc,hiredate asc) rn from emp)where rn=1;
SELECT DEPARTMENT_ID,MAX(SALARY) FROM EMPLOYEES
GROUP BY DEPARTMENT_ID;
Sign up for STechies
Ask Question From Our Experts
All the site contents are Copyright © www.stechies.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies. The site www.stechies.com is in no way affiliated with SAP AG.
Every effort is made to ensure the content integrity. Information used on this site is at your own risk.
The content on this site may not be reproduced or redistributed without the express written permission of
www.stechies.com or the content authors.