Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mapping to same table

Status
Not open for further replies.

saimon65

Technical User
Jan 2, 2002
16
AU
Hi.I have 3 tables.Tbl_Movement, Tbl_Product and Tbl_Branch.
I want to move a product from one branch to another.
In my Tbl_Movement I want to record the product moved, from branch, to branch.
The problem is, in the Tbl_Movement, branch_code is coming twice.(from and to).Is this a many to many relationship?..
I dont know how to make therelationship.Please help.
Should I have two seperate tables again?..one for FronBranch and another for ToBranch?
thanks.
 
The relationship is officially many to many, although the actual relationship is 1:2 That is, each Tbl_Movement record must have 2 brach records, one FromBranch and one ToBranch.

Tbl_Branch
Branch_ID
Branch_Name
Branch_Postal_Code
etc

Tbl_Product
Product_ID
Product_Name
etc

Tbl_Movement
Movement_ID
Product_ID
Branch_From (foreign key to Tbl_Branch)
Branch_To (foreign key to Tbl_Branch)
Quantity_Moved
etc

-------------------------
The trouble with doing something right the first time is that noboby appreciates how difficult it was.
- Steven Wright
 
Oops, I mis-stated. The relationship is one to many, or in reality, 1:2 (one to two).

The same kind of thing happens with orders where you have a bill to address and ship to address. The difference with this situation is that the ship-to and bill-to could be the same. In your case, transfers must have two different branches.

-------------------------
The trouble with doing something right the first time is that noboby appreciates how difficult it was.
- Steven Wright
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top