窗口函数允许对数据进行高级分析和计算,例如排名和累计和。
-- 计算每个员工在其职位组中的工资排名
SELECTFirstName,LastName,Position,Salary,RANK() OVER (PARTITION BY FirstName,LastName ORDER BY Salary DESC) AS Rank
FROM Employees;-- 计算每个员工在其职位组中的工资排名
SELECTT1.SFC,T1.STATUS_BO, RANK() OVER (PARTITION BY T1.HANDLE,T1.SFC ORDER BY T1.CREATED_DATE_TIME DESC) AS FREQUENCY_COUNT
FROM WIP.SFC T1