Skip to content
Advertisement

How to add the missing months name to the sql table in sequence by checking the previous month name?

I want to add the missing months to the table. If the current row having missing month then it should check the previous row and the name of the month in that row and add the next month in the current row. For eg: the current month is null, it should check the month name in previous row, if the previous row having January then the current month should replace null with February, for eg. if the current month is null, it should check the month name in previous row having August then next null month name should be replaced with September.

Code for the creating table:

output is:

BUT I WANT THE OUTPUT LIKE:

Advertisement

Answer

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