Reputation: 23
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.
Upvotes: 0
Views: 47
Reputation: 3751
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
Upvotes: 1