Good Morning,
I want to query a table that contains multiple appointments with time stamped status code changes for each appointment. Specifically, I need to pull the immediate next record in time, after the last "IN" status. Below, you see that in this case, "MT" is the next code after the last "IN".
Appt Status Time_stamp
1234 YD 11/21/2018 8:00
1234 YD 11/21/2018 8:05
1234 YD 11/21/2018 8:20
1234 YD 11/21/2018 8:23
1234 YD 11/21/2018 8:30
1234 IN 11/21/2018 9:30
1234 IN 11/21/2018 9:45
1234 IN 11/21/2018 9:50
1234 MT 11/21/2018 11:05
1234 MT 11/21/2018 11:10
1234 MT 11/21/2018 11:13
1234 SHP 11/21/2018 12:55
1234 SHP 11/21/2018 12:56
1234 SHP 11/21/2018 12:58
I want to query a table that contains multiple appointments with time stamped status code changes for each appointment. Specifically, I need to pull the immediate next record in time, after the last "IN" status. Below, you see that in this case, "MT" is the next code after the last "IN".
Appt Status Time_stamp
1234 YD 11/21/2018 8:00
1234 YD 11/21/2018 8:05
1234 YD 11/21/2018 8:20
1234 YD 11/21/2018 8:23
1234 YD 11/21/2018 8:30
1234 IN 11/21/2018 9:30
1234 IN 11/21/2018 9:45
1234 IN 11/21/2018 9:50
1234 MT 11/21/2018 11:05
1234 MT 11/21/2018 11:10
1234 MT 11/21/2018 11:13
1234 SHP 11/21/2018 12:55
1234 SHP 11/21/2018 12:56
1234 SHP 11/21/2018 12:58