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 Neelima Yadla <Ne...@CBC-Companies.com> on 2007/07/27 16:31:43 UTC

subqueries in criteria

Hi,

 

How to write criteria for the following sql,

 

select count (*) from (select first, max (second), third

from testtable

group by first, third

 

Thanks,

Neelima

 

 


RE: subqueries in criteria

Posted by Thomas Fischer <fi...@seitenbau.net>.
Hi,

here is an example from one of the test classes for creating a subquery:

Criteria subquery = new Criteria();
subquery.addSelectColumn(AuthorPeer.AUTHOR_ID);
subquery.add(AuthorPeer.NAME, author2.getName());
Criteria criteria = new Criteria();
criteria.add(AuthorPeer.AUTHOR_ID, subquery, Criteria.IN);

List result = AuthorPeer.doSelect(criteria);

   Hope this helps,

         Thomas

"Neelima Yadla" <Ne...@CBC-Companies.com> schrieb am 27.07.2007
16:31:43:

> Hi,
>
>
>
> How to write criteria for the following sql,
>
>
>
> select count (*) from (select first, max (second), third
>
> from testtable
>
> group by first, third
>
>
>
> Thanks,
>
> Neelima
>
>
>
>
>


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