[Zope] zSQL syntax
Thomas B. Passin
tpassin@mitretek.org
Thu, 31 May 2001 11:32:43 -0400
[Sebal]
>
> BUT this one query#3
> SELECT t1.ntheme , t1.valtheme <<<<<<<<<<<<<<<<<<
> FROM tabdef_theme AS t1 , tab_theme AS t2
> WHERE t2.ndoc =<dtml-var numero_doc>
> AND t1.ntheme = t2.ntheme
> GROUP BY t1.valtheme
> ORDER BY t1.valtheme
>
> I get:
>...
>
/usr/local/Zope-2.3.1-linux2-x86/lib/python/Products/ZGadflyDA/gadfly/kjbuck
ets0.py,
> line 534, in __getitem__
> KeyError: (see above)
I think it's an incorrect error message. I believe that the GROUP BY clause
has to include all columns named in the SELECT clause. I doubt that the
GROUP BY does anything for you anyway - it's only useful when you compute
aggregate functions like AVG, SUM, etc. Get rid of it and rely on ORDER BY
to organize your results.
Cheers,
Tom P