db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cameron Hickey" <...@panoramatos.com>
Subject RE: A complex SQL query
Date Tue, 03 Feb 2004 20:05:28 GMT
Excuse me if I am misunderstanding your problem but this SQL query seems
quite a bit strange to me why isn't it...

Select ROWNUM, vendor_code From lot_set where ROWNUM>10 AND ROWNUM<20
Order BY ROWNUM

And if this is the goal, then you have to use the criterion object
because you are referencing the same column twice in one query...

This is copied from the criteria how to:

Criteria criteria = new Criteria();
criteria.add(InvoicePeer.COST, 1000, Criteria.GREATER_EQUAL);

Criteria.Criterion criterion = criteria.getCriterion(InvoicePeer.COST);
criterion.and(
               criteria.getNewCriterion(
                             criterion.getTable(),
                             criterion.getColumn(),
                             new Integer(5000),
                             Criteria.LESS_EQUAL )
               );

Hope this helps

Cameron
-----Original Message-----
From: John Varghese [mailto:john.varghese@kalzoom.com] 
Sent: Saturday, January 31, 2004 3:36 PM
To: torque-user@db.apache.org
Subject: A complex SQL query

Hi,
  How to write this using torque

SQL>  select ROWNUM , vendor_code from (select * from lot_set order by
vendor_code) where          
                ROWNUM <20
  2   minus
  3   select ROWNUM , vendor_code from (select * from lot_set order by
vendor_code) where  
                ROWNUM <10;

    ROWNUM     VENDOR_COD
----------     ----------
        10     0000004127
        11     padmin
        12     padmin
        13     padmin
        14     padmin
        15     padmin
        16     padmin
        17     padmin
        18     padmin
        19     padmin


Pls help
Bye
John


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