Gracias por la respuesta Francisco, he podido avanzar un poquito más :)

ahora me encuentro con otro problema. Si hago la query poniendo los campos
del group by también en el select:

String sql = "select " + field_1_Name + ", " + field_2_Name + ", count(" +
field_2_Name + ") as total from '" + sds.getName() + "' group by " +
field_1_Name + ", " + field_2_Name + ";";
DataSource ds = sds.getDataSourceFactory().executeSQL(sql,
DataSourceFactory.MANUAL_OPENING);      

ds.getRowCount(); me devuelve 12767 resultados, así que el group by
funciona.
pero cuando itero por los resultados:

SelectionFieldIterator iterator = new SelectionFieldIterator(ds, selection,
2);                          
String  total = "";
while(iterator.hasNext()) {
         total =
iterator.next().getStringValue(ValueWriter.internalValueWriter);                
            
}

al debugar esto, el valor de "total" va siendo 1, 2, 3, 4,..., 12767 (). La
función "count" no funciona como debería, o estoy iterando mal por los
resultados de la query?


Dani González Moratona
[email protected]
________________________
Geodata Sistemas, S.L.
C/Bac de Roda 136 1r 1a

Telf: 93.303.53.67
http://www.geodata.es





--
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/group-by-en-GDBMS-tp6250025p6250645.html
Sent from the gvSIG desarrolladores mailing list archive at Nabble.com.
_______________________________________________
gvSIG_desarrolladores mailing list
[email protected]
http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_desarrolladores

Responder a