Is it possible to do this in one search: select count(1), sum(field1) from table where condition group by field2

See aggregations. They do exactly this.