clear markdown compare help donate or buy diddy dollings comments/suggestions/bugs a leap of faith? bible365
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 582727 fiddles created (13326 in the last week).

create table SHIFT_LOG_ENTRY ( SHIFT_LOG_DET_ID integer, ENTRY_TIME timestamp )
 hidden batch(es)


insert into SHIFT_LOG_ENTRY(SHIFT_LOG_DET_ID, ENTRY_TIME) values (1, timestamp'2019-09-19 16:13:00');
1 rows affected
 hidden batch(es)


insert into SHIFT_LOG_ENTRY(SHIFT_LOG_DET_ID, ENTRY_TIME) values (1, timestamp'2019-09-19 16:32:00');
1 rows affected
 hidden batch(es)


insert into SHIFT_LOG_ENTRY(SHIFT_LOG_DET_ID, ENTRY_TIME) values (1, timestamp'2019-09-19 16:45:00');
1 rows affected
 hidden batch(es)


select SHIFT_LOG_DET_ID, ENTRY_TIME, datediff(minute from ENTRY_TIME to NEXT_ENTRY_TIME) as DURATION from ( select a.SHIFT_LOG_DET_ID, a.ENTRY_TIME, (select min(ENTRY_TIME) from SHIFT_LOG_ENTRY where SHIFT_LOG_DET_ID = a.SHIFT_LOG_DET_ID and ENTRY_TIME > a.ENTRY_TIME) as NEXT_ENTRY_TIME from SHIFT_LOG_ENTRY a ) b
SHIFT_LOG_DET_ID ENTRY_TIME DURATION
1 2019-09-19 16:13:00 19
1 2019-09-19 16:32:00 13
1 2019-09-19 16:45:00
 hidden batch(es)


select SHIFT_LOG_DET_ID, ENTRY_TIME, datediff(minute from ENTRY_TIME to lead(ENTRY_TIME) over (partition by SHIFT_LOG_DET_ID order by ENTRY_TIME)) as DURATION from SHIFT_LOG_ENTRY
SHIFT_LOG_DET_ID ENTRY_TIME DURATION
1 2019-09-19 16:13:00 19
1 2019-09-19 16:32:00 13
1 2019-09-19 16:45:00
 hidden batch(es)