(Untitled)

Mar 03, 2009 15:41

I don't know why this one is giving me such trouble - I've written much more complex queries. Table OITM has ItemCode and Vendor - 1 line per item. Table OITW has ItemCode, WarehouseCode, BOH (balance on hand) and MTD_Sales - 1 line per item per WH. For Vendor XYZ, I'm trying to get a list of ItemCodes with total BOH and total MTD_Sales for all ( Read more... )

Leave a comment

Comments 2

the_darkglow March 4 2009, 03:18:31 UTC
This is totally off the top of my head so it may not even work:

SELECT ItemCode, SUM(BOH), SUM(MTD_Sales)
FROM OITM, OITW
WHERE OITM.ItemCode = OITW.ItemCode
AND Vendor = 'XYZ'
GROUP BY ItemCode

*hope I didn't embarrass myself with some obvious mistake*

Reply

minotaurs March 4 2009, 04:33:44 UTC
See, I knew it was going to be something simple and elegent that I'd smack myself for. Thanks! I was running round in circles trying nested selects and other crazyness.

Reply


Leave a comment

Up