Many to one and One to Many relationship parallely

There’s a table called ‘Bills’ and there’s a table called ‘Payments’.

I want to be able to:

  1. Select multiple bills and associate the total of the bills to a single payment (say bills worth 100, 200 and 300 are paid in a single payment of 600)

  2. Select one large bill and associate it with multiple payments (say a bill worth 600 is paid in 3 payments of 100, 200 and 300).

What’s the way to achieve this?

Theoretically table B should be the child of A, and at the same time table A should be the child of B.

Is this practically possible?

This is called a many to many relationship.

1 Like