db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bertrand VENZAL" <bertrand.ven...@cirso.fr>
Subject RE how to write a criteria involved with count, group
Date Wed, 07 Sep 2005 16:08:33 GMT
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" <jhan@bynum.com> 
07/09/2005 16:14
Veuillez répondre à
"Apache Torque Users List" <torque-user@db.apache.org>


A
"Apache Torque Users List" <torque-user@db.apache.org>
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: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message