[Zope-DB] ZSQL, sum() and you

Federico Di Gregorio fog@mixadlive.com
Mon, 3 Sep 2001 09:27:49 +0200


Scavenging the mail folder uncovered Mitch Pirtle's letter:
> Imagine, if you will, a ZSQL method called dbGetEmp containing "select *
> from emp"; and want to also retrieve sum(salary).  This is with tables
> in MySQL.  For the life of me, I cannot find any summing features in
> Zope - do I gotta do this in Python just to get a total on one column?

maybe i don't understand correctly the problem, but wouldn't...

      SELECT *, sum(salary) as sum_of_salary FROM emp
      
do it?

-- 
Federico Di Gregorio
MIXAD LIVE Chief of Research & Technology              fog@mixadlive.com
Debian GNU/Linux Developer & Italian Press Contact        fog@debian.org
  Lord, defend me from my friends; I can account for my enemies.
                                                  -- Charles D'Hericault