In the dataset I have a row for every status change per student. They usually go from null > Registered > Intake > Registered or Rejected. The period start at January first and ends at July first.
Table 1
| Student_ID | Begin_date | End_date | From_Status | To_status |
|---|---|---|---|---|
| 1 | 20-1-2020 | 25-1-2020 | null | Registered |
| 1 | 25-1-2020 | 20-2-2020 | Registered | Intake |
| 1 | 20-2-2020 | 20-2-2020 | Intake | Admitted |
| 2 | 20-2-2020 | 25-2-2020 | null | Registered |
| 2 | 25-2-2020 | 4-4-2020 | Registered | Intake |
| 2 | 4-4-2020 | 4-4-2020 | Intake | Rejected |
I want to have a dataset in which I have a row for every month until the first of july. Furthermore, for every month in between status changes.
Desired results:
| Date_ID | Student_ID | Begin_date | End_date | From_Status | To_status |
|---|---|---|---|---|---|
| 20200101 | 1 | 20-1-2020 | 25-1-2020 | null | Registered |
| 20200102 | 1 | 25-1-2020 | 20-2-2020 | Registered | Intake |
| 20200102 | 1 | 20-2-2020 | 20-2-2020 | Intake | Admitted |
| 20200103 | 1 | 20-2-2020 | 20-2-2020 | Intake | Admitted |
| 20200104 | 1 | 20-2-2020 | 20-2-2020 | Intake | Admitted |
| 20200105 | 1 | 20-2-2020 | 20-2-2020 | Intake | Admitted |
| 20200106 | 1 | 20-2-2020 | 20-2-2020 | Intake | Admitted |
| 20200102 | 2 | 20-2-2020 | 25-2-2020 | null | Registered |
| 20200103 | 2 | 25-2-2020 | 4-4-2020 | Registered | Intake |
| 20200104 | 2 | 25-2-2020 | 4-4-2020 | Registered | Intake |
| 20200104 | 2 | 4-4-2020 | 4-4-2020 | Intake | Rejected |
| 20200105 | 2 | 4-4-2020 | 4-4-2020 | Intake | Rejected |
| 20200106 | 2 | 4-4-2020 | 4-4-2020 | Intake | Rejected |
In my database I am only allowed to create views, so I cannot add a date table.
Any suggestion? Thanks in advance!