[Solved] SQL Server 2008 : calculate date and price change
Something like: DECLARE @artSales TABLE (artid int, dt date, price money); INSERT @artSales VALUES (1, ‘20170102’, 10), (1, ‘20170108’, 10), (1, ‘20170112’, 8.50), (1, ‘20170115’, 8.50), (2, ‘20170102’, 20), (2, ‘20170109’, 20), (2, ‘20170112’, 35), (2, ‘20170116’, 40), (3, ‘20170101’, 500), (3, ‘20170111’, 500), (3, ‘20170130’, 500); SELECT artid, dt, oldPrice = price, PriceChange = … Read more