Hello Rusty,
Torque API structure looks like this
1. JDBC
2. Village
3. Torque API
Torque is based on the Village which extends JDBC functionality...
So when you looks for more advance SQL functionality and Torque do not
support its, you can go down and use Village or JDBC API...Usually
Village will be enough!
So, you want use group by statement...
import com.workingdogs.village.*;
import org.apache.turbine.om.peer.BasePeer;
...
String qyery="SELECT person_id, first_name, last_name FROM person
GROUP BY sex";
Vector v = BasePeer.executeQuery(query);
for (int i = 0; i < v.size(); i++)
{
Record record = ((Record)v.elementAt(i));
Log.info("personId=" + record.getValue(1).asInt() + " firstName="
+record.getValue(2).asString() + " lastName" +
record.getValue(3).asString() );
}
Of course you can put the query result(Vector) into the context and use it in
your Village template...
Village is a better solution for queries that return a lots of records,
because of memory management. Torque wrap each returned record into
a business object what is not healthy for the memory!
Best Regards
RG> I'm just getting started using Torque, and I think I hit a road
RG> block. I can't seem to figure out how to do SQL "GROUP BY" statements
RG> using the Criteria object. Could someone please help me out by showing
RG> me an example of how to do this? I figured there would be an
RG> "addGroupBy" method for the Criteria object but I guess it's trickier
RG> than that. If it turns out there's not a way to do this, how have you
RG> gotten around that limitation? Also, if there's no way to do this,
RG> could someone point out to me where I might start implementing this
RG> functionality? Any help is appreciated. Thank you!
______________________________________
Leksiu ([EMAIL PROTECTED])
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>