RE: [PHP] mySQL / PHP Join Question

From: Date: Sun, 09 Sep 2001 06:28:56 +0000
Subject: RE: [PHP] mySQL / PHP Join Question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-66585@lists.php.net to get a copy of this message
On 09-Sep-2001 Dana Holt wrote: > > I have a query that uses a LEFT JOIN, but the two tables have some columns > with the same name. How can I tell the columns from each table apart? It > seems that the "joined" table overwrites the values from the other table. > If the column is part of the join criterion, it won't matter. otherwise, alias the column name: SELECT t1.id as siteid, t2.id as wmid, t2.name as name FROM site as t1 LEFT JOIN webmaster as t2 USING (id) WHERE t2.name is NOT NULL ... Regards, -- Don Read dread@texas.net -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it.

« previous php.general (#66585) next »