LAG function gives us value which was encountered in previous line.
There is no lag value available for 1 row, and 0 (zero) is returned. Is it possible/Is there a way to return the current value (instead of previous) in this case?
LAG(SalesOrderDetailID, 2) OVER (ORDER BY SalesOrderDetailID ) LagValue
FROM Sales.SalesOrderDetail s
WHERE SalesOrderID IN (43670, 43669, 43667, 43663)
ORDER BY s.SalesOrderID, s.SalesOrderDetailID, s.OrderQty