Jump to content

Archived

This topic is now archived and is closed to further replies.

AV1611

Multiple Joins

Recommended Posts

Table 1 has fields a,b,c,d

 

Table 2 has fields a,b,f,g

 

Table 3 has fields a,h,f

 

 

Can I join:

table1 a - table2 a,

table2 a - table3 a,

table2 f - table3 f

 

???

 

(This is a leaning exersize on my part, so don't kill yourself!)

I Can't figure this out. I know my query browser will allow me to make the links, but I don't really understand it well enough to use it...

BUT, I did a three table query today without JOINS, and it took FOREVER!!!

 

Thanks!

Share this post


Link to post
Share on other sites

erm you could make a script which copys the info from one table to another.

like.

$query = mysql_query("SELECT a FROM table1 WHERE row=a'");
$valuea = mysql_result($query, 0, "a");
mysql_query("INSERT INTO table1 (a) VALUES ($valuea)");
                     UPDATE

 

This code might not work because of mysql_result but its just a quick code. Its just ideas. Hope i helped

Share this post


Link to post
Share on other sites

My favorite intro to JOINs: [a href=\"http://hashmysql.org/index.php?title=Introduction_to_Joins\" target=\"_blank\"]Intro[/a]; [a href=\"http://hashmysql.org/index.php?title=More_Advanced_Joins\" target=\"_blank\"]More Advanced[/a]. With a little bit of knowledge you can certainly accomplish this join entirely on your own. And since this is a learning exercise, that is the idea, no?

Share this post


Link to post
Share on other sites

In the spirit of the learning exercise, I won't give you the answer -- just remember that for each relation, you need a set of tables and a join condition; that should help point you in the right direction, especially after reading those tutorials. Good luck!

Share this post


Link to post
Share on other sites

????

 

Those links are both dead???

 

:/

 

[!--quoteo(post=331750:date=Dec 30 2005, 10:37 PM:name=Arenium)--][div class=\'quotetop\']QUOTE(Arenium @ Dec 30 2005, 10:37 PM) 331750[/snapback][/div][div class=\'quotemain\'][!--quotec--]

My favorite intro to JOINs: [a href=\"http://hashmysql.org/index.php?title=Introduction_to_Joins\" target=\"_blank\"]Intro[/a]; [a href=\"http://hashmysql.org/index.php?title=More_Advanced_Joins\" target=\"_blank\"]More Advanced[/a]. With a little bit of knowledge you can certainly accomplish this join entirely on your own. And since this is a learning exercise, that is the idea, no?

 

Share this post


Link to post
Share on other sites

Must be a temporary outage -- the whole site seems like it's down for now, though it was working just fine yesterday.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.