Re: php - mysql problem

From: Date: Fri, 14 Apr 2006 17:48:24 +0000
Subject: Re: php - mysql problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-234008@lists.php.net to get a copy of this message
thanks for your posting, but I have: table1 id name value table2 id x y i want to id name value x y but there is no id from table 2 that is in table2.id and i want the resource to bu something like this: id(from table 1) name value (empty) (empty) Jay Blanchard wrote: > [snip] > $sql = "SELECT * FROM table1 LEFT JOIN > table2 USING id WHERE ... > GROUP BY table1.id"; > > mysql_query($sql); > > the problem is, that, when in table2 is not matching data using that id, > i lose that id from output array. but i don`t want to.. is there any > posibility to keep that id? > [/snip] > > More of a mysql question but do a left outer join with no group by > statement. > > SELECT table2.* > FROM table1 LEFT OUTER JOIN table2 > ON(table1.id = table2.id) > WHERE table1.id IS NULL > > > Returns all of table2 id's where there is no id in table1 >

« previous php.general (#234008) next »