I think it will be something like that in your usertablePeer.java file

criteria = new Criteria();
crit.addSelectColumn("COUNT("+ USERNAME+")");
crit.add(USER_ID, 0);
crit.addGroupByColumn(USER_NAME);
List litems = doSelect(crit);

but maybe you can switch the variable COUNT and use the litems.size() ....

hope this help ..






"jill han" <[EMAIL PROTECTED]> 
07/09/2005 16:14
Veuillez répondre à
"Apache Torque Users List" <[email protected]>


A
"Apache Torque Users List" <[email protected]>
cc

Objet
how to write a criteria involved with count, group






How can I write a criteria that is equivalent to:

SELECT USER_NAME, COUNT(USER_NAME) NUMOFUSERS
FROM USERTABLE
WHERE USER_ID = 0000
GROUP BY USER_NAME;

Thanks in advance.
Jill


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to