purchline has
itemid, deliverydate, qtyordered
select * from purchline
itemid deliverydate qtyordered
74700 01/01/2000 50
74700 01/01/2007 51
74700 01/01/2010 5
Q.
I would prefer to see this as a stored procedure and look as follows:
itemid deliverydates TotalOrdered
74700 01/01/2000 01/01/2007 01/01/2010 106
Edited for SQL Server 2005
If you are using SQL Server:
Test with the following: