db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Felipe Ramos" <fra...@tissat.es>
Subject Re: where (a.id=b.id or a.id is null)
Date Fri, 24 Oct 2003 07:42:04 GMT
I'll give you a complete example:
SELECT  FROM prop_property WHERE prop_property.ZON_ID=1 AND 
((prop_property.AGE_ID>='1' AND prop_property.AGE_ID<=6) OR 
(prop_property.CIT_ID>=1 AND prop_property.CIT_ID<=9))

     Criteria crit = new Criteria();

         crit.add(PropPropertyPeer.ZON_ID,1);

         Criteria.Criterion a1 = crit.getNewCriterion( 
PropPropertyPeer.AGE_ID,
            (Object) (new Integer(1).toString()), Criteria.GREATER_EQUAL);
         Criteria.Criterion a2 = crit.getNewCriterion( 
PropPropertyPeer.AGE_ID,
            (Object)( new Integer(6)), Criteria.LESS_EQUAL);
      
        Criteria.Criterion b1 = crit.getNewCriterion(
            PropPropertyPeer.CIT_ID, (Object)(new Integer(1)), 
Criteria.GREATER_EQUAL);
        Criteria.Criterion b2 = crit.getNewCriterion(
            PropPropertyPeer.CIT_ID, (Object)(new Integer(9)), 
Criteria.LESS_EQUAL);

        crit.add( a1.and(a2 ).or(b1.and(b2)));


With null, I use de Criteria.CUSTOM


Andrew Belonogov wrote:

>Hello
>I need a criteria something like
>  where (a.id=b.id or a.id is null)
>
>  
>

-- 
------------------------
Felipe Ramos
Tissat SA
C/ Orense 34-9ยช
28020 Madrid
Tel: (+34) 91 4175913 
Fax: (+34) 91 4172914
Mail: framos@tissat.es
------------------------




---------------------------------------------------------------------
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