I am trying to build a dynamically table with columns when we supply a start date
i.e.
Source Table like this:
| Income# | recurrent income | no of recurrences | income start date |
|---|---|---|---|
| 1 | 10000 | 5 | 2024/01/28 |
The output required:
| Income# | income start date | 2024-01 | 2024-02 | 2024-03 | 2024-04 | 2024-05 |
|---|---|---|---|---|---|---|
| 1 | 2024/01/28 | 10000 | 10000 | 10000 | 10000 | 10000 |
Please help if anyone has idea of how to build a SQL script. thanks
I tried CTE function, it did not work
Income#with differentincome start dates or a differentno of recurrences?. Also the you question with the DBMS you are using (SQL Server etc.)