MySQL Left Join Question

From: Date: Mon, 01 Sep 2003 22:00:36 +0000
Subject: MySQL Left Join Question
Groups: php.general 
Request: Send a blank email to php-general+get-161389@lists.php.net to get a copy of this message
This may not be the best place to ask this question, but I'm running into a problem when I perform a left join sql statement in PHP. The sql statement is as follows: SELECT p.id pid,p.designID,p.project_name,p.node,p.received,p.lots,p.ugfootage,p.aerialf ootage,p.node,c.* FROM projects as p LEFT JOIN proSub as c on p.id=c.projectID WHERE p.id=$id I have verified that $id has a value. What I'm finding is that when there is no corresponding entry in proSub, the query returns nothing even though LEFT JOIN is supposed to return the contents of the left table even if the right table has no data. The left data does have data and I am asking for the correct value for p.id. I've run into some other scripts on my site where left join does not behave the way it's supposed to. Any thoughts?? Robbert van Andel

« previous php.general (#161389) next »