stewartorris
05-23-2003, 06:54 AM
Hello,
I have yet another question! This involves loops again. Forgive me, I'm still learning.
I am trying to retreive and sort through a tbl of records for inventory transactions. I want to get all the records from the tbl that relate to a particular Purchase Order (poID). Then I want to group all of the records together that are transactions for the same product (productID). Within those like records, I need to add together the unitsOrdered fields for a total units ordered amount to display. This table is listed below.
tbl: trans_inventory
tbl fields:
transID
transDate
productID
poID
invoiceID
unitsOrdered
unitsReceived
Here's my problem, I can't seem to get started with getting the records and grouping them. I keep getting aggregate function errors because I am trying something like this:
SELECTpoID, productID, unitsReceived, unitsOrdered FROM trans_inventory WHERE poID = "& poNumber &" GROUP BY productID
(poNumber is a variable defined earlier.)
Any thoughts? Any suggestions, as always, will be greatly appreciated. Thank you!
JSO
I have yet another question! This involves loops again. Forgive me, I'm still learning.
I am trying to retreive and sort through a tbl of records for inventory transactions. I want to get all the records from the tbl that relate to a particular Purchase Order (poID). Then I want to group all of the records together that are transactions for the same product (productID). Within those like records, I need to add together the unitsOrdered fields for a total units ordered amount to display. This table is listed below.
tbl: trans_inventory
tbl fields:
transID
transDate
productID
poID
invoiceID
unitsOrdered
unitsReceived
Here's my problem, I can't seem to get started with getting the records and grouping them. I keep getting aggregate function errors because I am trying something like this:
SELECTpoID, productID, unitsReceived, unitsOrdered FROM trans_inventory WHERE poID = "& poNumber &" GROUP BY productID
(poNumber is a variable defined earlier.)
Any thoughts? Any suggestions, as always, will be greatly appreciated. Thank you!
JSO