db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From noel_fuen...@freddiemac.com
Subject Re: Correlated sub query in torque
Date Fri, 21 May 2004 13:30:40 GMT

key   2ndkey       nbr  seq   amount
1     100   100   1     10
2     100   100   2     11
3     100   100   3     9
4     200   101   1     50
5     200   102   1     200
6     200   102   2     100
7     300   103   1     12

select *
from bid a
where a.key = (select b.key, max(seq) from bid b where b.nbr = a.nbr and
b.2ndkey = a.2ndkey group by b.nbr)
and 2ndkey = 100

thanks,
nf



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