I know i can get first_value() and last_value() over partitioned sql query which is ordered by a column I know, but let's say I want the second value, or the third... Is there a function to do so? Thanks in advance.
Asked
Active
Viewed 43 times
1 Answers
1
As far as I know, there is no specific function for that. However you can select the second row like this:
with row_numbers AS(select row_number() over(order by yourColumn) as 'row', *
from table)
select * from row_numbers
where row=2

Bura Chuhadar
- 3,653
- 1
- 14
- 17
-
thank you, I thought there is a better way to do so. – user3688929 May 29 '14 at 20:06