[Zope] ZmysqlDA
Andy Dustman
andy@dustman.net
29 May 2002 13:44:17 -0400
On Wed, 2002-05-29 at 13:18, Oliver Marx wrote:
> select * from table1 left join table2 on table1.id=table2.id
>
> Error:
> duplicate column name, id
>
> Is this an error or a feature?
You have id in both tables, so it appears twice in the result of the
JOIN (feature); using * returns it twice.
Also, id is a reserved name in Zope, so you need to do something like
this:
SELECT col1, col2, ... coln, id AS id_
FROM table1 LEFT JOIN table2 USING(id)
(USING is just a shortcut in this case for your condition).
--
Andy Dustman PGP: 0x930B8AB6
@ .net http://dustman.net/andy
"Cogito, ergo sum." -- Rene Descartes
"I yam what I yam and that's all that I yam." -- Popeye