Hi Ludwig,

never done that, but I would suppose you could use criteria.getNewCriterion and 
use the SqlEnum.JOIN as your comparison. Than use criteria.criterion.or to 
create an or between the two.

See:

http://db.apache.org/torque/releases/torque-3.3/runtime/apidocs/org/apache/torque/util/Criteria.html

http://db.apache.org/torque/releases/torque-3.3/runtime/apidocs/org/apache/torque/util/SqlEnum.html

http://db.apache.org/torque/releases/torque-3.3/runtime/apidocs/org/apache/torque/util/Criteria.Criterion.html

Regards,

Hidde.

----- "Ludwig Magnusson" <lud...@itcatapult.com> wrote:

> Hi!
> 
> I want to create an SQLQuery that combines data from three tables.
> Right
> now, my javacode looks like this:
> 
> Criteria.addJoin(TableA.id, TableB.fk);
> 
> Criteria.addJoin(TableA.id, TableC.fk);
> 
>  
> 
> This results in this SQL query: 
> 
> .
> 
> WHERE TableA.id = TableB.fk 
> 
> AND TableA.id = TableC.fk
> 
> .
> 
>  
> 
> However, this is not the result I need. What I need is a query with
> OR
> instead of AND, like this:
> 
> .
> 
> WHERE TableA.id = TableB.fk 
> 
> OR TableA.id = TableC.fk
> 
> .
> 
>  
> 
> I haven't found any way to do this using criteria. Is it possible?
> 
> /Ludwig

-- 
Hidde Boonstra
Us Media B.V.
Stadhouderskade 115
1073 AX Amsterdam

t: 020 428 68 68
f: 020 470 69 05
www.usmedia.nl

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

Reply via email to