![]() |
![]() |
![]() |
Database Relationship Problem I am sure this will probably be a no-brainer for most of you but I am having some trouble with some relationships in a database I am designing in MySQL. I have 2 elements (charges and transactions) that I need to associate. The issue is a charge may be associated with multiple transactions and a transaction may be associated with multiple charges. What would be the most efficient way to represent this? The solutions I have come up with so far have seemed kludgy at best.
Jon Lindbo
http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=many-to-many+database+-access
eclectic_echidna
You need a join table to create the many-to-many relstionship.
Ewan's Dad
Thanks for all of the help
Jon Lindbo
Ewan's Dad is correct:
anon
The solution to implementing a many-to-many relationship in relational databases is very standard and is a bit kludgy. C'est la vie. That stuff you saw on Google is where it's at, I'm afraid.
Herr Herr
It's not really cludgy when you think about it in terms of relations. A 'join table' coincides very well with the mathematical notion of an arbitrary binary relation on (the sets of keys of) your two tables. Which is exactly what you're trying to model.
Matt
I don't understand this.
Raju Patel
For the data I am modeling a charge represents a charge for service that is associated with a particular account. It contains information related to that charge like the charge type and terms. A transaction has information about that actual exchange of monetary funds that pay for one, many or part of a charge. I guess a more common ware to think of what I am calling a charge would be a debit but I am not keeping a running balance. I only track active charges and keep a history of transactions that paid those charges.
Jon Lindbo
|