Saturday, 17 August 2013

How to combine many to many join?

How to combine many to many join?

Tables:
cust table:
cust_id, name, etc
bill table:
bill_id, cust_id, amt, due_date, status (open/closed)
payment table:
payment_id, bill_id, amt etc
Customer can settle a single bill by paying multiple installments. So, one
bill_id may relate to payment_ids.
I am unable to generate this recordset:



cust_id | due amt



'due amt' is the sum of all bill.amts - sum of all payment.amts and having
status open.

No comments:

Post a Comment