[prev in list] [next in list] [prev in thread] [next in thread] 

List:       turbine-torque-user
Subject:    RE: torque and subqueries
From:       Thomas Fischer <fischer () seitenbau ! net>
Date:       2005-05-13 9:43:50
Message-ID: OFDC9C1E85.D73D70DC-ONC1257000.0034F3EF-C1257000.00357457 () seitenbau ! net
[Download RAW message or body]





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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic