I'm not using Torque, just monitoring the mailing list in case we move in that 
direction.  

The DISTINCT in your query is unnecessary (and will probably be removed by the 
optimizer anyway).  The GROUP BY makes the DISTINCT redundant.

-----Original Message-----
From: Michael Kashambuzi [mailto:[EMAIL PROTECTED]
Sent: Friday, October 03, 2003 5:16 AM
To: [EMAIL PROTECTED]
Subject: COUNT(*) in Torque


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: [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