-
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 :
C1
---
1
2
2
3
3
4
5
6
7
8
9
11
13
17
- 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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|