Please help me identify my mistake:
My db has 4 tables:
Orders Table
Order IDOrder Date
Order Details Table
Order Details IDQuantityRate
Payments Table
Payment IDOrder IDAmount Received
Here is the relationship between them:
I'm using ORDERS and ORDER DETAILS (Two Tables) as a single order may have multiple products.
Now i have made a query to Calculate BALANCE AMOUNT:
In this query you see two records. In both the records ORDER DATE, QUANTITY, RATE, AMOUNT BILLED are same. But AMOUNT RECEIVED are different. This is because i have entered two part-payment records for a particular Order ID in the PAYMENTS Table.
The problem is that the above query would double the AMOUNT BILLED (on summation). What should i do to correct this.
Thankx in advance!