Criteria object doesn't support inner queries, because not all databases support them. So you can try something this like this, but remember that this solution highly depends on your database:
Criteria criteria = new Criteria();
criteria.setDistinct();
criteria.addSelectColumn(YourPeer.COL1);
criteria.add(YourPeer.COL2, "value1");
Criteria criteria2 = new Criteria();
criteria2.add(YourPeer2.COL1, (Object)(YourPeer2.COL1 + " NOT IN " + BasePeer.createQueryString(criteria)), Criteria.CUSTOM);
YourPeer2.doSelect(criteria2);
Regards, Kostya
Chris Joelly wrote:
Hello!
i'm trying to build a criteria for the following selects:
i hava a table from which i want to read a column:
select distinct col1 from table1 where col2 = 'value1'
then i want to use the list with the values 'col1' in another select statement:
select * from table2 where col1 not in ('values from table1.col1 read with previous select')
are there a simple way to use Criteria for this task?
thx, Chris
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
