I am not even sure if I am asking the question properly. I imagine that this is just me going outside my " SQL comfort zone." I am using Toad 4.1 with an Oracle database.
The issue I am trying to address is to take data that is periodic in nature and transform it so that I have a continuous list of data that includes that unit’s status for each period of time. Specifically, my data looks somewhat like this:
UNIT
TERM CODE
STARTING TERM
STATUS
1
201201
201201
R
1
201303
201201
N
1
201401
201201
R
1
201601
201201
N
What I want to do is create a list of records that show that unit’s status for each term code between the unit’s starting term and now. Assuming that “now” is 201703, then I want the results to look like this:
UNIT
TERM CODE
STATUS
1
201201
R
1
201202
R
1
201203
R
1
201301
R
1
201302
R
1
201303
N
1
201401
R
1
201402
R
1
201403
R
1
201501
R
1
201502
R
1
201503
R
1
201601
N
1
201602
N
1
201603
N
1
201701
N
1
201702
N
1
201703
N
The goal of this is to be able to link this result set to other queries where a term code can return the applicable status code for that specific term.
Any guidance is appreciated!