[Zope] ZSQL error using MySQLDA

Anthony Baxter Anthony Baxter <anthony@interlink.com.au>
Thu, 02 Sep 1999 10:02:04 +1000


>>> Rick Ree wrote
> I have a MySQL query as follows:
> 
> select foo.id, bar.name, count(*)
> from foo, bar
> where (foo.id = bar.id)
> group by foo.id

> Error, exceptions.KeyError: unhandled
> 
> Why might this be?  If I omit count(*) from the query it runs fine, or if
> I use count(*) in a query involving only a single table, it also works. 

try this: 
select foo.id, bar.name, count(*) as cnt
 from foo, bar
 where (foo.id = bar.id)
 group by foo.id

The returned columns from an SQL query have to be named something that
Zope can deal with (and have to be uniquely named).

Anthony