Lets say I have the following table:
SomeTable(
id,
price
)
How do I select the 2nd highest priced row from this table?
Note : This has to be done in Pl/SQL, in a database agnostic way.
Is it possible to do this without any loops?
- I know how this is done using Oracle constructs like
rownumor mysql constructs likelimit, so I am not looking for those.
Isn’t this simple? God knows why I didn’t think about it before!
select max(price) from tnum
where price <> (select max(price) from tnum)