db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cristian Zoicas <zoi...@medialab.sissa.it>
Subject Re: How to create a join ?
Date Thu, 11 Dec 2003 13:20:53 GMT


On Thu, 11 Dec 2003, Samuel Le Berrigaud wrote:

> You may want to have a look at this page :
>
> http://db.apache.org/torque/peers-howto.html  (at the bottom of the page)
>
> the part named "Examples" seems to be what you want ...
>
> SaM

Thank  you anyway and without  being  offensive  but the example you
pointed ( shown below ) is not exactly the same thing in my opinion.

>>> BEGIN EXAMPLE <<<<

    select * from abc where (a < 1 and b > 2) or (  a > 5  and b < 3)

    Criteria crit = new Criteria();
    Criteria.Criterion a1 = crit.getNewCriterion(ABC.A, 1, Criteria.LESS_THAN);
    Criteria.Criterion b2 = crit.getNewCriterion(ABC.B, 2, Criteria.GREATER_THAN);
    Criteria.Criterion a5 = crit.getNewCriterion(ABC.A, 5, Criteria.GREATER_THAN);
    Criteria.Criterion b3 = crit.getNewCriterion(ABC.B, 3, Criteria.LESS_THAN);

    crit.add(a1.and(b2).or(a5.and(b3)));

>>> END EXAMPLE <<<

Here are the reasons:

  1. the FROM caluse contains only one table.
  2. The getNewCriterion method allows you to add
         a) a column name
         b) a value
         c) a comparison statement between the column name
             and the value.

     and I need a getCriterion which allows me to add :
         a) a column name;
         b) a column name;
         c) a comparison statement between the columns.

     Does torque lack such a method or is it possible to do it in
     another way ?

Cristian Zoicas





>
> Cristian Zoicas wrote:
>
> >Hello all
> >
> >I've tried to figure out how to use the Criteria class in
> >order to obtain a statement like
> >
> >SELECT
> >       *
> >FROM
> >       T1, T2, T3
> >WHERE
> >       ( T1.id_t1= T2.id_t1 AND T2.id_t3 = T3.id_t3 )
> >       OR
> >       ( T1.id_t3 = T3.id_t3 )
> >
> >but I was not able to do it.
> >Does anybody has any solution ?
> >
> >Thank you in advance
> >Cristian Zoicas
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> >For additional commands, e-mail: torque-user-help@db.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>


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


Mime
View raw message