You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by "Robles, Rogelio" <Ro...@experian.com> on 2004/06/14 19:28:14 UTC

How to do nested queries using the criteria API?

I need to do a query like this:

SELECT ...
FROM 
	( 
	  // find the MAX B.colX number of each group of A.colA + A.colB
	  //
	  SELECT A.colA as A, A.colB as B, MAX(B.colX) as X
        FROM A, B
        GROUP BY A.colA, A.colB
        WHERE A.colA = B.colA AND A.colB = B.colB
       ) as tmpTable, otherTable 
WHERE tmpTable.B = otherTable.B and tmpTable.X > otherTable.aLimit

And I need to do this because that's what
org.apache.torque.util.LargeSelect() is expecting as an input parameter, a
Criteria object, though, it will be good to create a LargeSelect()
constructor that accepts free form queries, or at least using the
com.workingdogs.village.QueryDataSet(), 
what you guys have done in a situation like this? 

Rogelio

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