nadeemshafi9 Posted October 3, 2007 Share Posted October 3, 2007 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 Quote Link to comment Share on other sites More sharing options...
fenway Posted October 3, 2007 Share Posted October 3, 2007 Replace each comma with the words "INNER JOIN", then move each corresponding WHERE clause portion to an ON clause. But it won't be any faster, just easier to read. Quote Link to comment Share on other sites More sharing options...
nadeemshafi9 Posted October 3, 2007 Author Share Posted October 3, 2007 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 Quote Link to comment Share on other sites More sharing options...
fenway Posted October 3, 2007 Share Posted October 3, 2007 No idea... post the EXPLAIN Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.