Hi,
I would like to derive the status datetime from joining and aligning start datetime and end datetime from original data as below.
I would like to take the record which has end datetime as it is aligned with start datetime plus additional the last record but without end date time hence expected result as per below
it may be simple for some of you but i couldn't figure out to take the last record.
Any practical query answer would be greatly appreciated.
Thanks,
I would like to derive the status datetime from joining and aligning start datetime and end datetime from original data as below.
Code:
APPT_I STUS_C STRT_S END_S
123 APPT 02/10/2023 14:10:31 ?
123 APPT 02/10/2023 14:10:31 09/10/2023 08:00:06 -- take this record
123 DRFR 09/10/2023 08:00:06 ?
123 DRFR 09/10/2023 08:00:06 10/10/2023 10:50:09 -- take this record
123 APIP 10/10/2023 10:50:09 ?
123 APIP 10/10/2023 10:50:09 11/10/2023 09:41:46 -- take this record
123 APPC 11/10/2023 09:41:46 ?
123 APPC 11/10/2023 09:41:46 16/10/2023 11:28:26 -- take this record
123 APPT 16/10/2023 11:28:26 16/10/2023 11:33:35 -- take this record
123 APIP 16/10/2023 11:33:35 16/10/2023 11:33:57 -- take this record
123 APPC 16/10/2023 11:33:57 ?
123 APPC 16/10/2023 11:33:57 27/10/2023 09:46:33 -- take this record
123 NPWI 27/10/2023 09:46:33 ? -- take this record
I would like to take the record which has end datetime as it is aligned with start datetime plus additional the last record but without end date time hence expected result as per below
Code:
APPT_I STUS_C STUS_T
123 APPT 02/10/2023 14:10:31
123 DRFR 09/10/2023 08:00:06
123 APIP 10/10/2023 10:50:09
123 APPC 11/10/2023 09:41:46
123 APPT 16/10/2023 11:28:26
123 APIP 16/10/2023 11:33:35
123 APPC 16/10/2023 11:33:57
123 NPWI 27/10/2023 09:46:33
it may be simple for some of you but i couldn't figure out to take the last record.
Any practical query answer would be greatly appreciated.
Thanks,