Ok, task 1: SELECT bd.Serial_ID, s.Lot_ID, Sum(bd.Bin_Quantity) as qty FROM BinD bd INNER JOIN Serial s ON s.Serial_ID = bd.Serial_ID INNER JOIN Transaction t ON t.Transaction_Id = bd.TransactionID WHERE t.date BETWEEN date1 AND date2 -- This is made up, I assume it is where the date is stored GROUP BY s.Lot_ID, bd.Serial_ID
No looping, hope that is what you're after ;) Dominic -- Blog it up: http://fusion.dominicwatson.co.uk ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296286 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4