[GRASSLIST:9555] Using SUM() in SELECT db.execute..

Hi to all guys!

I have to create a table using this line:

CREATE TABLE abit_totali AS SELECT cod_comune, SUM( totale_abitanti) from
abit_cens GROUP BY cod_comune

Reading SQL guide, I noticed that sum() can't be used in SELECT expression...
How can I solve this problem (i am using dbf...)?

Thx
Luca
--
"Esperienza è il nome che ciascuno da ai suoi errori. (O. Wilde) "

GENTOO-GIS Development Team
jabber: casagrande@jabber.linux.it

On Sat, Dec 17, 2005 at 04:15:26PM +0000, Luca Casagrande wrote:

Hi to all guys!

I have to create a table using this line:

CREATE TABLE abit_totali AS SELECT cod_comune, SUM( totale_abitanti) from
abit_cens GROUP BY cod_comune

Reading SQL guide, I noticed that sum() can't be used in SELECT expression...
How can I solve this problem (i am using dbf...)?

Luca,

more complex SQL statements can be used for all other backends
than DBF. You may consider to switch to sqlite which is also
locally stored.

Markus

Thx
Luca
--
"Esperienza è il nome che ciascuno da ai suoi errori. (O. Wilde) "

GENTOO-GIS Development Team
jabber: casagrande@jabber.linux.it

--
Markus Neteler <neteler itc it> http://mpa.itc.it
ITC-irst - Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18 - 38050 Povo (Trento), Italy

Alle 18:41, sabato 17 dicembre 2005, Markus Neteler ha scritto:

On Sat, Dec 17, 2005 at 04:15:26PM +0000, Luca Casagrande wrote:
> Hi to all guys!
>
> I have to create a table using this line:
>
> CREATE TABLE abit_totali AS SELECT cod_comune, SUM( totale_abitanti) from
> abit_cens GROUP BY cod_comune
>
> Reading SQL guide, I noticed that sum() can't be used in SELECT
> expression... How can I solve this problem (i am using dbf...)?

Luca,

more complex SQL statements can be used for all other backends
than DBF. You may consider to switch to sqlite which is also
locally stored.

Markus

> Thx
> Luca

This weekend I installed Postgresql 8.1 and copied all my tables inside
it...Now query works very fine..
Thx!
Luca
--
"Esperienza è il nome che ciascuno da ai suoi errori. (O. Wilde) "

GENTOO-GIS Development Team
jabber: casagrande@jabber.linux.it