Sum Multiple Records

tjr222

Registered User.
Local time
Today, 11:16
Joined
Jun 12, 2002
Messages
30
I have two tables:

- one is called invoice with fields, INum(key), IName, IDate, ICompany, IPONum, and ITotal.

- The second table is called product with fields, PNum(related to INum many to 1), PDescription, PPrice.

Since the tables are related on a many to 1, each invoince can have many products, each with a different PPrice value. I would like to in a query sum the PPrice and store that value in ITotal.
Therefore ITotal would be the total of all products that are on 1 invoince.

Hopefully this makes sense and anyhelp will be appreciated.


Thank you,

Tom
 
How about something along the lines of:
UPDATE INVOICE
SET ITOTAL = (
SELECT sum(PPRICE) from PRODUCT
WHERE INVOICE.INUM = PRODUCT.INUM
(
WHERE any other condition that applies to all
 

Users who are viewing this thread

Back
Top Bottom