You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by no...@freddiemac.com on 2004/05/21 15:17:05 UTC

Correlated sub query in torque

does anybody know how to construct a criteria  to retrieve the record with
the highest sequence number from a sub group of records (nbr column) using
the data and table structure below?

id    seq   nbr   amount
12    1     500   500
13    2     500   400
14    3     500   450
15    1     501   400
16    1     502   200
17    1     503   350
18    1     504   325
19    2     504   325

i would like to be able to retrieve id 14, 15, 16, 17, and 19 only.

thanks,
nf



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


Re: Correlated sub query in torque

Posted by Bogdan Vatkov <bv...@globaltech-bg.com>.
do you have a suggestion of the SQL that would do that ?

regards,
bogdan
----- Original Message -----
From: <no...@freddiemac.com>
To: <to...@db.apache.org>
Sent: Friday, May 21, 2004 4:17 PM
Subject: Correlated sub query in torque


> does anybody know how to construct a criteria  to retrieve the record with
> the highest sequence number from a sub group of records (nbr column) using
> the data and table structure below?
>
> id    seq   nbr   amount
> 12    1     500   500
> 13    2     500   400
> 14    3     500   450
> 15    1     501   400
> 16    1     502   200
> 17    1     503   350
> 18    1     504   325
> 19    2     504   325
>
> i would like to be able to retrieve id 14, 15, 16, 17, and 19 only.
>
> thanks,
> nf
>
>
>
> ---------------------------------------------------------------------
> 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