I'm working on an analysis using SQL (SSMS). Currently my dataset has two columns, a date that a product was added to our stock room and the date that the product was sold. I need to add a new column to each row showing how many items total we had in stock on the date that the new product was added to the stock room.
Hope this makes sense. I've been playing around in SQL, but don't really now where to go from here.
Date_Added | Date_Sold | Inventory
2011-01-08 | 2011-02-26 | 1
2011-01-11 | 2011-02-08 | 2
2011-01-11 | 2011-03-01 | 3
2011-01-15 | 2011-03-05 | 4
2011-01-15 | 2011-03-05 | 5
2011-02-10 | 2011-03-31 | 5
2011-03-04 | 2011-04-01 | 5
2011-03-06 | 2011-04-03 | 4