I have a table of records like this:
Item | From | To |
---|---|---|
A | 2018-01-03 | 2018-03-16 |
B | 2021-05-25 | 2021-11-10 |
The output of select should look like:
Item | Month | Year |
---|---|---|
A | 01 | 2018 |
A | 02 | 2018 |
A | 03 | 2018 |
B | 05 | 2021 |
B | 06 | 2021 |
B | 07 | 2021 |
B | 08 | 2021 |
Also the range should not exceed the current month. In example above we are asuming current day is 2021-08-01.
I am trying to do something similar to THIS with CONNECT BY LEVEL but as soon as I also select my table next to dual and try to order the records the selection never completes. I also have to join few other tables to the selection but I don't think that would make a difference.
I would very much appreciate your help.