简体   繁体   English

SQL EMP & DEPT - 年薪、佣金

[英]SQL EMP & DEPT - annual salary, commision

List name, annual salary and commision of all Sales whose monthly salary is greater than their commision.列出月薪高于佣金的所有销售人员的姓名、年薪和佣金。 the output should be ordered by salary, highest first, if two or more employees have the same salary sort by employee name, within the Lowest salary order.输出应按薪水排序,最高在前,如果两个或多个员工的薪水相同,则按员工姓名排序,在最低薪水顺序中。

在此处输入图片说明

Based on the query mentioned in the comments i think you need ROW NUMBER OVER PARTITION.根据评论中提到的查询,我认为您需要 ROW NUMBER OVER PARTITION。 An example would be along the lines一个例子是沿着线

  Select ename, sal*12 as annualsal, com
  ROW_NUMBER() OVER (PARTITION BY sal ORDER BY ename) as RowOrder FROM EMP_TABLE
  WHERE sal < COM
  Order by sal Desc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM