SQL order to have max-1, max-2, max-3 ...
We want to have the max, max-1, ..., max-9 of a table column.
So, suppose that you have a table with 1 column (C1) and with the following rows :
- first sql statement to have the max-1 : 13
- second sql statement to have max-2 : 11
to have max-1, I used this statement :
select max(C1) from
(select C1 from (select C1 from z_tab where C1 < (select max(C1) from z_tab))
could you suggest the best method to have result desired.
Click Here to Expand Forum to Full Width