Hi Francesco, You can do the following: ReportQueryByCriteria query = QueryFactory.newReportQuery(Clazz.class, new Criteria()); query.setAttributes(new String[] { "max(value1)", "value2" }); query.addOrderByAscending("max(value1)"); query.addGroupBy("value2"); Iterator itr = pb.getReportQueryIteratorByQuery(query);
I hope that helps. Regards, Vasily On 11/22/06, Francesco Martinelli <[EMAIL PROTECTED]> wrote:
Hi, I would like to retrieve a record using the following SQL-Like statement: "select max(value) from " + className Does anyone know how to "convert" this to OQL? I know it would be possible to retrieve all the records, then sort them out, and pick up the first, but I would prefer to reduce the amount of data retrieved from the database. I also wonder if it were possible to order the "resultset" according to one field, e.g. of SQL-like would be: "select xxx from " + className + " order by value". Thenk you, Francesco. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]