Hi Gurus & @mathguy ,
Please find the table structure and insert statements:
create table tv_temp1(person_id number,date_start date,date_end date,ABSENCE_ATTENDANCE_TYPE_ID number);
insert into tv_temp1 values(1,to_date('15-Jan-2025'),to_date('17-Jan-2025'),1);
insert into tv_temp1 values(2,to_date('20-Jan-2025'),to_date('22-Jan-2025'),1);
insert into tv_temp1 values(1,to_date('18-Jan-2025'),to_date('20-Jan-2025'),1);
insert into tv_temp1 values(1,to_date('22-Jan-2025'),to_date('28-Jan-2025'),1);
insert into tv_temp1 values(1,to_date('10-Feb-2025'),to_date('12-Feb-2025'),1);
insert into tv_temp1 values(2,to_date('27-Jan-2025'),to_date('02-Feb-2025'),1);
insert into tv_temp1 values(2,to_date('03-Feb-2025'),to_date('10-Feb-2025'),1);
My requirement is to get start_date & end_date for continuous absence records, eg for person_id 1 (records highlighted in bold), there is continuous absence records, 15-Jan to 17-Jan, 18-Jan to 20-Jan, where as for other records for person_id 1, there are no continuous absence records, so I need output as below:
Person_id Date_start Date_End
1 15-Jan-25 20-Jan-25
2 27-Jan-25 10-Feb-25
Regards
Raj