db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Kashambuzi" <mkashamb...@k2tp.com>
Subject COUNT(*) in Torque
Date Fri, 03 Oct 2003 12:15:56 GMT
Hi:

I was wondering how one can do the following in Torque.

I have a table people which has rows where the lastname can be repeated
multiple times.  I'm trying to do

SELECT DISTINCT LASTNAME, COUNT(*)
FROM PEOPLE
GROUP BY LASTNAME
ORDER BY LASTNAME ASC

I've generated all the Torque classes for my DB.

I MUST use a LargeSelect given the number of rows that could be returned so
I thought I could somehow use a Criteria object like so

Criteria c = new Criteria();
c.addAscendingOrderByColumn(PeoplePeer.LASTNAME);
c.addGroupByColumn(PeoplePeer.LASTNAME);
c.setDistinct();

LargeSelect ls = new LargeSelect(c, 10, 10);

But how would I get it to return the count?

Or would it be necessary to use the Query class to build my own query which
would mean having to populate the value obejcts myself?



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message