[RESOLVED] complex query... :(
Hi,
I have a db as followed:
1. people table- with personID, currentFunds.
2. Product table - with productID, price
3. peoplePurchases table- with productID (FK to products), personID (FK to people).
I need to create the following query:
1. will summarize for each person, and each price level of the products (assuming several product could have same price) how many products he purchased of this price, out of how many products he could purchase with his current funds.
example:
current funds= 24$
purchased:
apple-1$
banana- 12$
mango- 12$
(other product existing: choclate= 10$)
person name | 1$ products | 10$ products | 12$ products
john | 1/24 | 0/2 | 2/2
any ideas?