[Qgis-developer] problem with GROUP BY in `Execute SQL` Processing

Régis Haubourg regis.haubourg at eau-adour-garonne.fr
Fri Jan 16 02:12:29 PST 2015


Ok, 
I see some issues:;:
1- your query does WHERE  +  GROUp BY. SQL standards requires a HAVING
CLAUSE with group by:

select * from au group by ID HAVING ID > 100

2- Geoprocessing waits for a spatial layer in return. I think  you need to
add explicit aggregate operators for your columns and geometry columns. 
select ST_UNION(GEOMETRY) GEOMETRY, sum(myfield1) sum  FROM au group by ID
HAVING ID > 100

3- not sure geoprocessing will handle that correctly if you do not need a
spatial table. I did it once using ogr SQL execute from a python script.
Ther you can handle exactly what output type you need (text, table, html
result...)





--
View this message in context: http://osgeo-org.1560.x6.nabble.com/problem-with-GROUP-BY-in-Execute-SQL-Processing-tp5181825p5181839.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list