Jump to content

Recommended Posts

somone help please i left my book at home i cant rember how to do a INNER JOIN on more than 3 tables ??

 

here is my current join where i have put conditions in the WHERE istead of joining but this is prooviung to be slow.

 

"SELECT ".

"p.physreq_title, ".

"p.physreq_text, ".

"e.enviroserv_title, ".

"e.enviroserv_text, ".

"f.finish_title, ".

"f.finish_text ".

 

"FROM ".

"physreq_table p, ".

"enviroserv_table e, ".

"finish_table f, ".

"xref_physreq_rds x_p_r, ".

"xref_enviroserv_rds x_e_r, ".

"xref_finish_rds x_f_r, ".

"rds_table r ".

 

"WHERE ".

"p.physreq_id = x_p_r.physreq_id ".

"AND r.rds_id = x_p_r.rds_id ".

"AND e.enviroserv_id = x_e_r.enviroserv_id ".

"AND r.rds_id = x_e_r.rds_id ".

"AND f.finish_id = x_f_r.finish_id ".

"AND r.rds_id = x_f_r.rds_id ".

 

"AND r.rds_id = '".$this_rds->rds_id."';";

 

these are many to many relations so they have XREF tables inbetween

 

please help

 

thankls

Link to comment
https://forums.phpfreaks.com/topic/71666-sql-inner-join-3-tables/
Share on other sites

what i am doing is allowing people to search for text and then in the result show the text of that item with the keyword and also the text of its related items in the key words it takes 8 seconds or more ??

 

how can i go abouts making it quicker.

 

thanks again

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.