May 29, 2002 #1 don2241 IS-IT--Management Jun 1, 2001 57 AU Hi! Imagine having a table with attributes: s#--p#--j#--qty How can I get the second smallest value of 'qty' Thank you Martin
Hi! Imagine having a table with attributes: s#--p#--j#--qty How can I get the second smallest value of 'qty' Thank you Martin
May 29, 2002 #2 dickiebird Programmer Feb 14, 2002 758 GB Try :- set rowcount 1 select qty from tablename where qty > (select min(qty) from tablename ) order by qty (This suits sybase - your number of output rows may need different control) ;-) Dickie Bird db@dickiebird.freeserve.co.uk Upvote 0 Downvote
Try :- set rowcount 1 select qty from tablename where qty > (select min(qty) from tablename ) order by qty (This suits sybase - your number of output rows may need different control) ;-) Dickie Bird db@dickiebird.freeserve.co.uk
May 29, 2002 #3 grega Programmer Feb 2, 2000 932 GB Or you could say ... select min(qty) from table where qty > (select min(qty) from table) Greg. Upvote 0 Downvote
May 29, 2002 Thread starter #4 don2241 IS-IT--Management Jun 1, 2001 57 AU Thank you very much. Martin Upvote 0 Downvote
Jun 10, 2002 #5 barbarul2001 IS-IT--Management Nov 19, 2001 25 RO if you want another solution... select distinct a.qty from table a where 1=(select count(*) from table b where a.qty>b.qty) it works in every dbms i know. web/sql developer Upvote 0 Downvote
if you want another solution... select distinct a.qty from table a where 1=(select count(*) from table b where a.qty>b.qty) it works in every dbms i know. web/sql developer