[EMAIL PROTECTED] wrote:
Ok, I trying to get this example... what is "table1 t1, table2 t2, table3 t3, table4 t4", I mean, what does the t1, t2, t3, t4 represent? If you say, table 1, table 2, etc.... well, I assume that, but isn't that there already?
Let me, or may I, give ask again with my visual? Here are my tables and keys:
table1: person_ID < primary key) lastName firstName
table2: machine_ID < primary key) person_ID model_ID location OS
table3: model_ID < primary key) make_ID model
table4: make_ID < primary Key) make
I tried various:
SELECT lastName, location, model, make FROM table1, table2, table3, table4 WHERE table2.person_ID = table1.person_ID AND table3.make_ID = table4.make_ID;
You are missing a relationship
SELECT lastName, location, model, make FROM table1, table2, table3, table4 WHERE table2.person_ID = table1.person_ID AND table3.make_ID = table4.make_ID AND table2.model_ID=table3.model_ID;
The relationships are: table1 one-to-many table2 table2 many-to-one table3 table3 many-to-one table4
(help?)
Thanks, you all are GREAT! (I googled "4-way JOIN"... not a lot of joy -for me anyway.)
Ted
On Thursday, June 26, 2003, at 02:00 AM, Venkata Srinivasa Rao, Yerra wrote:
SELECT t1.key,t2.col,t3.*,t4.col2 FROM table1 t1, table2 t2, table3 t3, table4 t4
WHERE t1.key=t2.key AND t1.key=t3.key AND t1.key=t4.key
At 01:23 AM 6/26/2003 -0400, you wrote:
I grown my db to 4 tables 8). I'm going to ask this plainly in hopes that my "syntax" in ok:
I know how to SELECT * from 2 related tables and get all the records listed in the resultset.
(Either using INNER JOIN or WHERE.) Now... and I have been looking some books!
How do get a resultset of all records from 4 related tables?
Ted
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]