Jump to content

Multiple Joins


AV1611

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!

Link to comment
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

Link to comment
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?

Link to comment
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!

Link to comment
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?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.