拥有最高佣金的员工的平均工资是多少

时间:2022-11-27 09:13:11

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

我试图做这个问题,需要一些提示,我想用oracle sql中的分析函数来做。拥有最高佣金的员工的平均工资是多少

1 个解决方案

#1


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.

也许您可以提供有关表结构和数据模型的更多详细信息。再见。

#1


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.

也许您可以提供有关表结构和数据模型的更多详细信息。再见。