First post here. Fairly basic level of knowledge with SQL/Access. I need to merge two sets of data. Suppose we have a data set below that has an observation for two different units at a time step. I want to also join what phase the unit was in at that time.
ID Time Observation 1 1 111 1 2 101 1 3 134 1 4 137 1 5 167 1 6 42 2 1 210 2 2 222 2 3 235 2 4 648 2 5 13 2 6 19
The phase data looks as below. That is, there is only a recording for when a unit enters a new phase. For example, unit 1 was in phase 2 for time steps 4 and 5.
ID Phase EnterTime 1 1 1 1 2 4 1 3 6 2 1 1 2 2 5
The resulting table should look as follows. Can anyone help with some sample code? Any help would be greatly appreciated.
ID Time Observation Phase 1 1 111 1 1 2 101 1 1 3 134 1 1 4 137 2 1 5 167 2 1 6 42 3 2 1 210 1 2 2 222 1 2 3 235 1 2 4 648 1 2 5 13 2 2 6 19 2