Skip to content
Advertisement

How to increment date using previous value from same column and skip weekend date?

I have tried to increment date based on other date column and skip weekend date.

I know how to check weekend and how to skip date but I want to result as look like below

EX. If I will input date in one column like

then I want result in new column like

NOTE: don’t skip any row from input date

Advertisement

Answer

This seems quite tricky. I think my best advice is to reconstruct the data. A relatively simple method uses a recursive CTE:

Here is a db<>fiddle.

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