I am using Hana data studio (SQL) and need to write a cursor that takes the original dataset, makes column age set to 0 and sets the the fiscal quarter to the iterated value over a distinct list of fiscal quarters in the input data set (FY24Q1, FY24Q2, FY24Q3) and unions it to the original dataset for every distinct fiscal quarter.
Input sample data set:
| Name | Age | Fiscal_Quarter |
|---|---|---|
| James | 22 | FY24Q1 |
| Henry | 32 | FY24Q2 |
| Ethan | 45 | FY24Q1 |
| Jake | 19 | FY24Q3 |
Output:
| Name | Age | Fiscal_Quarter |
|---|---|---|
| James | 22 | FY24Q1 |
| Henry | 32 | FY24Q2 |
| Ethan | 45 | FY24Q1 |
| Jake | 19 | FY24Q3 |
| James | 0 | FY24Q1 |
| Henry | 0 | FY24Q1 |
| Ethan | 0 | FY24Q1 |
| Jake | 0 | FY24Q1 |
| James | 0 | FY24Q2 |
| Henry | 0 | FY24Q2 |
| Ethan | 0 | FY24Q2 |
| Jake | 0 | FY24Q2 |
| James | 0 | FY24Q3 |
| Henry | 0 | FY24Q3 |
| Ethan | 0 | FY24Q3 |
| Jake | 0 | FY24Q3 |