Hey there
Ive been struggling with this one for a few days now..
Lets say I have one huge employee table (which includes the groupID and salary) containing everyone from managers to engineers to maintenance.
I need a query that will return the records of the top 5% highest salaries of each group. I cannot afford to query each group separately as the table contains +- 30k records, and there are about 27 groups - it simply takes too long to execute.
Example of output im looking for:
GroupID | Salary
Engineer 25000
Engineer 23500
Manager 39999
Manager 30400
Manager 30900
Manager 30050
Accounts 89228
Accounts 89444
Accounts 89999
etc...
If anyone has any idea how to achieve this please let me know.
Thanks a lot
Ive been struggling with this one for a few days now..
Lets say I have one huge employee table (which includes the groupID and salary) containing everyone from managers to engineers to maintenance.
I need a query that will return the records of the top 5% highest salaries of each group. I cannot afford to query each group separately as the table contains +- 30k records, and there are about 27 groups - it simply takes too long to execute.
Example of output im looking for:
GroupID | Salary
Engineer 25000
Engineer 23500
Manager 39999
Manager 30400
Manager 30900
Manager 30050
Accounts 89228
Accounts 89444
Accounts 89999
etc...
If anyone has any idea how to achieve this please let me know.
Thanks a lot