db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Schmitt" <mi.schm...@gmx.de>
Subject Criteria: several columns OR-combined??
Date Sun, 06 Mar 2005 13:48:36 GMT

I'm trying to create something like
SELECT * FROM table_a WHERE table_a.col_1='xxx' AND (table_a.col_2='bla' OR
with the Criteria class.

I tried something like this:

Criteria c = new Criteria();
c.add(TableAPeer.COL_1, 'xxx');
c.or(TableAPeer.COL_2, 'bla');
c.or(TableAPeer.COL_3, 'blu');

but (of course) the  Method or() relates the given criterion to an existing
criterion for the same column.
For example, something like
c.add(TableAPeer.COL_1, 'xxx');
c.or(TableAPeer.COL_1, 'yyy');
will probably (not tested) result in
... WHERE ... AND (table_a.col_1='xxx' OR table_a.col_1='yyy') ...

I thought that I could do something like
1. create a new criterion
2. pass the (table_a.col_2='bla' OR table_a.col_3='blu') to the criterion
3. add the criterion to the criteria
but as far as I understand, a criterion always relates to a single column.

any ideas?


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

View raw message