[Zope] Using SQL aggregate functions

Tres Seaver tseaver@palladion.com
Mon, 28 Feb 2000 11:44:38 -0600


John Williams <J.A.R.Williams@aston.ac.uk> asked:
> Date: 28 Feb 2000 08:17:42 +0000
> 
> I have been trying to use SQL aggregate functions in SQL Methods to
> calculate some statistics e.g. something like
> 
> SELECT id,count(id) from data group by field
> 
> I am using MySQL, and the query works if entered directly from another
> client, however Zopes SQL method returns an error. Is this a known
> problem. Is there a known workaround or patch?

I believe that the aggregate column has a "name" which the DA doesn't like.  Try
aliasing it (the syntax for this depends on your RDBMS)::

  SELECT id,count(id) as count_id from data group by field

-- 
=========================================================
Tres Seaver         tseaver@palladion.com    713-523-6582
Palladion Software  http://www.palladion.com