danikuper
Registered User.
- Local time
- Today, 13:15
- Joined
- Feb 6, 2003
- Messages
- 147
This query may be simple but I can't make it work...
Here's the situation. I have several products, each product belongs to a product family. For example:
Family A contains:
Product A.1
Product A.2
Family B contains:
Product B.1
Product B.2
I have the following invoices:
Invoice #1
Product A.1.....$1,000
Product A.2.....$500
TOTAL:...........$1,500
Invoice #2
Product B.1......$500
Product B.2......$200
TOTAL:............$700
Invoice #3
Product A.2.....$500
TOTAL:..........$500
I want to query my invoices and get the total sales for the Families. The catch is this: I can only add total $$ for an invoice that has either A.1 or B.1 as products.
For the invoices above I would get:
Family A: $1,500
Family B: $700
I cannot add invoice #3 to the total of Family A because it has only A.2 and not A.1.
My tables look like:
tblInvoice
InvoiceID (PK)
CustomerName
InvoiceDate
tblItem
InvoiceID (PK)
ProductID (PK)
Revenue
tblFamily
FamilyID (PK)
FamilyName
tblProduct
ProductID(PK)
ProductName
FamilyID (FK)
Is this query possible? How would I do that?
Help!
Thanks in advance
daniel
Here's the situation. I have several products, each product belongs to a product family. For example:
Family A contains:
Product A.1
Product A.2
Family B contains:
Product B.1
Product B.2
I have the following invoices:
Invoice #1
Product A.1.....$1,000
Product A.2.....$500
TOTAL:...........$1,500
Invoice #2
Product B.1......$500
Product B.2......$200
TOTAL:............$700
Invoice #3
Product A.2.....$500
TOTAL:..........$500
I want to query my invoices and get the total sales for the Families. The catch is this: I can only add total $$ for an invoice that has either A.1 or B.1 as products.
For the invoices above I would get:
Family A: $1,500
Family B: $700
I cannot add invoice #3 to the total of Family A because it has only A.2 and not A.1.
My tables look like:
tblInvoice
InvoiceID (PK)
CustomerName
InvoiceDate
tblItem
InvoiceID (PK)
ProductID (PK)
Revenue
tblFamily
FamilyID (PK)
FamilyName
tblProduct
ProductID(PK)
ProductName
FamilyID (FK)
Is this query possible? How would I do that?
Help!
Thanks in advance

daniel