I am trying to do this question and need some hints, I want to do it with the analytic function in oracle sql. What is the average salary of the employees who have the highest commission
Asked
Active
Viewed 118 times
-4
-
You might want to take a look a aggregation function? – Peter Chaula Jun 03 '16 at 18:40
-
Please share more information on your table structure and what are you looking for. – Soven K Rout Jun 03 '16 at 18:46
1 Answers
0
it is hard to give you an proper answer without any details, but I will try. You can do something like this:
SELECT
T1.EMPLOYEE_NAME AS NAME,
T1.SALARY AS SALARY,
AVG(CASE WHEN T1.COMMISSION >=(
SELECT MAX(COMMISSION) FROM EMPLOYEETABLE)
THEN SALARY
ELSE 0
END) AS AVG_SALARY
FROM EMPLOYEETABLE T1
GROUP BY T1.EMPLOYYEE_NAME, T1.SALARY
ORDER BY T1.SALARY DESC
Maybe you can give further details on your table structure and data model. Bye.

V. Wolf
- 123
- 1
- 8