db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: torque and subqueries
Date Fri, 13 May 2005 09:43:50 GMT




Erik,

I have just come across an example of how to build a hand-built subquery
into an existing criteria. Perhaps one can also try to build the subquery
by using another criteria and use its toString()-Method or some more
sophisticated methods...

Criteria criteria = new Criteria();
...
criteria.add(StatistikEintragPeer.PERSON_ID, person.getId());
criteria.add(StatistikEintragPeer.STATISTIK_EINTRAG_ID,
    (Object)(StatistikEintragPeer.STATISTIK_EINTRAG_ID+" IN (SELECT
MAX("+StatistikEintragPeer.STATISTIK_EINTRAG_ID+") FROM
"+StatistikEintragPeer.TABLE_NAME+" GROUP BY
"+StatistikEintragPeer.PERSON_ID+")"), Criteria.CUSTOM);

List result = StatistikEintragPeer.doSelect(criteria, connection);

  Regards,

     Thomas


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