Skip to content
Advertisement

How to split lines in SQL table according to rules?

so I have SQL table with many lines. It looks like this (just a couple lines from the top):

Table example

I need to disperse revenue according to project duration equally every 2 months starting first month. So desired result would look like this:

enter image description here

What’s the baest way to achieve this?

Advertisement

Answer

You can use recursive cte :

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