0
一直試圖用下面的查詢找到在SQL Server同一列的連續行之間的差別,但我越來越常數差如何使用滯後函數
with cte as
(
select businessentityid,nationalidnumber,SickLeaveHours,LAG(sickleavehours) over (order by businessentityid) as PreviousRow
from HumanResources.Employee
)
select *,DIFFERENCE(sickleavehours,cte.previousrow) from cte
Thanks @Arion ... It works .... – Richu