Hello all...
I have read up on ways to achieve part of my subject - 2nd highest values -
However, mine is only slightly different yet it's killing me. I need the 2nd highest value for each group that is returned. For instance, the following data:
Should return:
Any help will be greatly appreciated. Thanks.
I have read up on ways to achieve part of my subject - 2nd highest values -
Code:
select min(field) from table where id in (select top 2 id from table order by field desc)
However, mine is only slightly different yet it's killing me. I need the 2nd highest value for each group that is returned. For instance, the following data:
Code:
level | group
-----------------
1 | 1
6 | 1
1 | 2
6 | 2
1 | 3
6 | 4
1 | 5
1 | 6
3 | 6
6 | 6
1 | 7
6 | 8
Code:
level | group
-----------------
1 | 1
1 | 2
1 | 3
6 | 4
1 | 5
3 | 6
1 | 7
6 | 8
Any help will be greatly appreciated. Thanks.