Como fazer para gerar um 'avg' (média) com 'group by'?
Data de postagem: May 24, 2010 12:25:43 PM
includeOnce -1897036629 /* /products/INTEQengine/library/iquery/IQuery.ijs */
IQuery.from( -2008889000 /* Títulos */ )
.column({field: "TIPO"})
.column({ avg: "VALOR" })
.toSql()
SQL Gerado:
select TITULO1.TIPO, avg(coalesce(TITULO1.VALOR, 0)) as VALOR
from TITULO TITULO1
where (
TITULO1.CLASSE in (
-2008889000,-2008888890,-2008888790,-1899998525,-1899998524,-1899998370,-1899998369,-1899998367,
-1899933806,51518,51519,35337524,35337539,35337623,35337638))
group by TITULO1.TIPO