-Brandon
----- Original Message ----- From: "Michael Schmitt" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, March 06, 2005 8:48 AM
Subject: Criteria: several columns OR-combined??
Hi,
I'm trying to create something like
SELECT * FROM table_a WHERE table_a.col_1='xxx' AND (table_a.col_2='bla' OR
table_a.col_3='blu')
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'); TableAPeer.doSelect(c);
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?
greetings, michael
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
