I have a simple under stock report. The SQL:
SELECT strStock AS 'Part',
strDescription AS 'Description',
strVendor AS 'Vendor',
decQuantityOnHand AS 'On Hand',
decQuantityOnOrder AS 'On Order',
decQuantityOnBO AS 'Back Order',
decQuantityCommitted AS 'Committed',
decMinimumQuantity AS 'Min',
decMaximumQuantity AS 'Max',
--decAvailableQuantity,
((-[decQuantityOnOrder] + decQuantityOnBO) - decQuantityCommitted) AS 'Actual Avail[actualavail]',
(select SUM(decQuantity) from ST2005.dbo.IN_History WHERE strStock=a.strStock AND dteTranDate > CAST((GETDATE() - 180) AS DATE)) AS 'Ordered last 180 days',
'test
test2' AS 'testfield'
FROM ST2005.dbo.IN_Master AS a
WHERE decQuantityOnHand < decQuantityOnOrder;
I would like to add the last three dates the product was ordered to a column. is that possible, or will I need another row for each date?