Experts Round Table Network
Navigate
Home
ArticleWiki
Forum
Journal
Search
Newsletter
Links
Tech News
expertsrt.com
Welcome Guest.
Username:
Password:
Remember me
Forgot your password?
Register
need help in resoving 2 many to one relationships
Welcome,
Guest
. Please
login
or
register
.
December 02, 2008, 09:18:03 AM
11304
Posts in
1248
Topics by
498
Members
Latest Member:
katCheeme
Home
Help
Search
Login
Register
Experts Round Table Network
|
Databases
|
MySQL
|
need help in resoving 2 many to one relationships
« previous
next »
Pages:
[
1
]
Print
Author
Topic: need help in resoving 2 many to one relationships (Read 410 times)
thepreacher
Offline
Posts: 77
need help in resoving 2 many to one relationships
«
on:
September 23, 2007, 12:13:47 PM »
Problem,
A transaction has an ID and Will also cause many Withdrawal IDs ( for now i am limited to 12 but you may consider unlimited Withdrawal IDs)
the same transaction ID will also be linked to many withdrawal amounts also 12 for now)
The withdrawal code and transaction ID is needed to retrieve the Withdrawal amount.
I need help to design a table the helps to easily store and retrieve the data.
Would be grateful if an explanation is provided for any solution.
Thanks
Logged
VGR
Mentor
Offline
Posts: 682
Re: need help in resoving 2 many to one relationships
«
Reply #1 on:
September 24, 2007, 12:29:55 PM »
easy.
make that relatioship table :
create table transac_to_withdr(id_transaction integer not null,id_withdrawal integer not null,withdrawal float not null);
the two keys can not be unique
the withdrawal amount is an attribute to the relationship, thus it's a field in the relationship table
This said, I wonder why you need a withdrawal id in the relation, the withdrawal amount is enough for the moment unless you've more withdrawal attriobutes, of course. As set up, the table could as well be named transaction_amounts(id_transaction integer not null,withdrawal float not null);
regards
Logged
techie overlord, answers all kind of questions on
http://www.europeanexperts.org
thepreacher
Offline
Posts: 77
Re: need help in resoving 2 many to one relationships
«
Reply #2 on:
September 24, 2007, 02:41:54 PM »
Thnks VGR for your help. Perhaps a scenario will better explain my problem.
-----
A person transfers say $500. One of the effects of this transaction is that an ID is generated. However the person wants to withdraw this amount in 5 equal installments (ie 100 x 5). A business decision is to assign each of the installments an ID such that the person will have to supply their Transaction ID and Withdrawal(or Installment) ID before they can collect their cash. With each successful withdrawal, the used Withdrawal Id is flag as used and hence cannot be used again.
Transaction ID --->Withdrawal ID--->Withdrawal Amount
Withdrawal ID--->Withdrawal Amount
Withdrawal ID--->Withdrawal Amount
Withdrawal ID--->Withdrawal Amount
etc ....
Withdrawal Amount is the same for different Withdrawal IDs
-----
I hope this makes things a little clearer.
warmest regards
«
Last Edit: September 24, 2007, 02:49:23 PM by thepreacher
»
Logged
Pages:
[
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
ERT 1.5
-----------------------------
=> Round Table Learning Center
=> Bug reports
-----------------------------
Legacy
-----------------------------
=> The next level
=> History of ERT
-----------------------------
Community Affairs
-----------------------------
=> Introductions
=> Ballot Box
===> Closed Polls
=> Soapbox
=> Propose and Consult
===> Propose and Consult...CLOSED
-----------------------------
Bits and Bytes
-----------------------------
=> Tips, Tricks, Snippets, Tidbits And General Pearls Of Wisdom
-----------------------------
Serverside Technology
-----------------------------
=> PHP
=> ASP
-----------------------------
Webservers
-----------------------------
=> Apache
=> IIS
-----------------------------
Databases
-----------------------------
=> MySQL
=> Access
=> MS SQL Server
-----------------------------
Clientside Technology
-----------------------------
=> HTML
=> CSS
=> Javascript
=> Flash
=> WAP/WML
-----------------------------
Web Technologies
-----------------------------
=> General Web Dev
=> Web Standards
=> XML
=> Online Marketing
-----------------------------
Graphics
-----------------------------
=> Graphics Design and Animation
-----------------------------
Programming
-----------------------------
=> .NET
=> JAVA
=> MS DOS Batch Scripting
=> Mathematics
=> C & C++
=> VB
=> Delphi
=> Algorithm design
-----------------------------
Operating Systems
-----------------------------
=> Windows (General)
=> NT Based (2K, 2K-03, NT, XP, Vista)
=> Open Source (All)
-----------------------------
Hardware
-----------------------------
=> Hardware General
=> Gamers Hardware (Advanced)
-----------------------------
Networking
-----------------------------
=> Home (small)
=> Office (large)
=> Internet
-----------------------------
Security
-----------------------------
=> General Security Issues
-----------------------------
Rants/Opinions/Proposals
-----------------------------
=> Site operation
Powered by SMF 1.1 RC2
|
SMF © 2001-2005, Lewis Media
Joomla Bridge by
JoomlaHacks.com