redbishop — 2013-10-02T09:37:44-04:00 — #1
please excuse the convoluted explanation. Hopefully someone can make sense of it.
I'm joining a number of tables. I've noticed that the query fails completely if I don't set all of the foreign keys properly. For example, table3 might have a column (id_two) which contains the foreign keys of another table. Now I need to manually add a number (key) to each field in the id_two column in table 3. The primary keys range from 1 upwards. If I add a 0 instead, the query will fail. Of course I understand that the join between the two tables will no longer work. What I don't understand is why the remainder of the joins don't continue to work. Does one JOIN failure break the query?
Thanks for your help!!!
$q = "SELECT a.column1, b.column1, b.column2, b.column3, c.column1, c.column2, d.column1 FROM table1 AS a
INNER JOIN table2 AS b USING (id_one)
INNER JOIN table3 AS c USING (id_two)
INNER JOIN table4 AS d USING (id_three)
WHERE b.column1 = '$name' ";
r937 — 2013-10-02T10:12:49-04:00 — #2
redbishop — 2013-10-02T14:53:31-04:00 — #3
Hi there Rudy,
thank you for the confirmation! I was hoping you'd say the other joins would still work, but alas...
r937 — 2013-10-02T15:11:31-04:00 — #4
technically, they are all working just fine, just not returning what you hoped for