Page 1 of 1

Relationships (1:1)

PostPosted: Tue Feb 14, 2012 3:19 pm
by wisni1rr
Hi again,

I am wondering how you can incorporate a 1to 1 relationship with xataface? I have several 1to 1 relationships in my current access project that I am converting to mySQL. I'm not sure how I should approach the situation...

Thanks for any advice you can provide!

Re: Relationships (1:1)

PostPosted: Tue Feb 14, 2012 6:12 pm
by samhans
very easy. just look at the tutorial in the documentation part.
if you find any problem then come back.

Re: Relationships (1:1)

PostPosted: Tue Feb 14, 2012 6:53 pm
by wisni1rr
Thanks for helping,

I went through the tutorial. It gives great examples for "1 to many" and "many to many" but I don't gather how to do a "1 to 1" relationship. Consider the following:

[TableA]
ID = INT(11) Auto_Increment, Primary

[TableB]
ID = INT(11)

For every record in [TableA] there can be exactly ONE OR NONE record in [TableB]

Could this be achieved by making ID in [TableB] unique?

Re: Relationships (1:1)

PostPosted: Tue Feb 14, 2012 11:10 pm
by samhans
could you explain more.

do you want any connection between table A and table B to be displayed in table A. or you just want that the id field of the table B to be filled from table A automatically.

Re: Relationships (1:1)

PostPosted: Wed Feb 15, 2012 9:46 am
by shannah
1:1 relationships currently are a bit tricky to deal with. I've had this on my list for a while but haven't gotten around to it. You can muddle around with regular relationships and kind of fudge it in there, but we really need to have a special case for 1:1.

Re: Relationships (1:1)

PostPosted: Wed Feb 15, 2012 12:08 pm
by wisni1rr
Thanks for you help!

I've decided to make a 1:many relation and set my many table to have its connecting record Index as Unique.

Thanks again!