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                                       [EMAIL PROTECTED]
-- 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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to