Hi Serge,

I didn't try that, but it should work:

query.setAttributes(new String[] {"id","count(*)"});
query.addOrderByAscending("count(*)");
query.addGroupBy("id");

If it doesn't work try changing "count(*)" to "count(1)".

Cheers,
 Vasily

On 6/8/06, Serge78 <[EMAIL PROTECTED]> wrote:

Hi!
I'm trying to sort results of a ReportQueryByCriteria by calculated field:

Criteria criteria = ...;
ReportQueryByCriteria query = new ReportQueryByCriteria(AClass.class,
criteria);
query.setAttributes(new String[] {"id","count(*)"});
query.addGroupBy("id");


Now i want sort by second field (count)
How can I do that?
query.setAttributes(new String[] {"id","count(*) AS aa"});
query.addOrderBy("aa", false);
Doesn't work.
Thank in advance.
--
View this message in context: 
http://www.nabble.com/Order-in-ReportQueryByCriteria-t1751968.html#a4763152
Sent from the Apache DB - ObjectRelationalBridge Users forum at Nabble.com.


---------------------------------------------------------------------
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]

Reply via email to