yxw158
yxw158

Reputation: 75

Oracle SQL: Get the previous values

I have two columns table: Id, and value.

ID Value
1
2 AA
3
4 BB
5
6
7
8 CC
9

I need a query in Oracle to return the result as

ID Value
1
2 AA
3 AA
4 BB
5 BB
6 BB
7 BB
8 CC
9 CC

Is there anyway to do this? Thanks in advance.

Upvotes: 2

Views: 85

Answers (1)

user5683823
user5683823

Reputation:

select id, last_value(value IGNORE NULLS) over (order by id) as modified_value
from   your_table
;

Upvotes: 3

Related Questions