Hello,
My name is Tanya and I am new to Yii. I would like to create an intermediate table using a join in order to link two models, however they do not share a primary key. I would like to do an inner join of the ID from table 1 and ID from table 2, and have a 3rd table linking the two (acting as an intermediate).
What I am unsure of (being a complete newbie) is how to link these two ids into the third table ..ex. [b]how to alter my relations in the models, and how to
see` this new table.[/b]
Here`s a bit of info on my tables;
Table 1;
Primary key => uniqueID (autoincrement)
name_ID
name
Table 2;
Primary key => uniqueID (autoincrement)
name2_ID
name2
What I would like to do is create a table where I can create a relationship between name_ID (table 1) and name2_ID (table 2), so that when I retrieve name_ID info from table 1, I can also get a hold of name2_ID’s associated with name_ID. It is a has_many relationship => name_ID has many name2_ID. The two tables DO NOT share a common entry found in both (for ex. name1 (table 1) and name1(table2)).
I’m sorry if what I am asking doesn’t make sense, I am having trouble vocalizing this. I have been reading lots of forum examples and online tutorials, but unfortunately I haven`t found a solution to my problem.
Thank you in advance for your help!