Skip to content
Advertisement

Oracle: How fill in the gaps between rows using previous next row’s values using sql

I have the table:

How fill in the gaps between rows using previous next row’s values in Oracle to get the following output:

the values of previous and next columns should be the same to fill the rows.

Advertisement

Answer

If you want all rows to be the same for a given year and id, just use max():

There seems to be no need for conditional logic. You could just do:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement