标签: sql-server
我有下表:
enter image description here
我正在尝试执行以下操作:
其中:
答案 0 :(得分:0)
请尝试以下操作:
SELECT t.BusDate,t.ClosingPrice ,t.ClosingPrice - COALESCE(LAG(t.ClosingPrice)OVER(ORDER BY t.BusDate ASC),0) AS [Difference] FROM [YourTableName] t ;