PDA

View Full Version : Please explain Inner Join, Left Join and Right Join


Boshi
07-21-2007, 11:40 PM
And how to get values using them, I have tried Mysql.com but their documentation is too big and I found very little about those. So I would appreciate the help...


Edit: Why can't I have:

if($sf < $subs["fcount"]) $subs=mysql_fetch_array($subs);
without it using more than 10MB of memory?
Btw, thats inside a for loop which is inside a for loop which is inside a while loop...

I decided not to make another thread just for that...

StupidRalph
07-22-2007, 05:15 AM
Try these links to learn a little more about joins:

http://www.w3schools.com/sql/sql_join.asp
http://dev.mysql.com/doc/refman/5.0/en/left-join-optimization.html
http://guelphdad.wefixtech.co.uk/sqlhelp/joins_basic.shtml (this link is written by CF's own MySQL moderator Guelphdad :thumbsup: )

If you have that many loops (3 :confused: ) then odds are you need to optimize your code a little better. It also, will be better if you do give it, its own thread in the appropriate forum (PHP). Not everyone here uses PHP. Also, no one can guess what your code is doing, you should provide more code to solve your problem. That if statement doesn't say much in terms of debugging. More than likely is the multiple loops especially of you're creating various arrays inside those loops.

Boshi
07-22-2007, 11:40 PM
Thanks, I figured that the IF was making the for loop Infinite :P Thanks to my brain for the idea of putting an (echo $sub.'<br />';) inside the loop...