I have a table of absence days, and I'm trying to build a view that will find all absence records for the same person which are consecutive, and returns the earliest consecutive date and latest consecutive date as well as the total days and hours - I.e. return the summary information for that single period of absence, even if it was entered as multiple consecutive records.
Below is an example of how the current data looks, and what information I am trying to return
Original Data:
AbsenceID PersonID AbsenceDay Days Hours 49334 9552 26/05/2020 0.5 3 49334 9552 27/05/2020 0.5 3 50000 9552 28/05/2020 1 7 50000 9552 29/05/2020 1 6 50010 9552 15/06/2020 1 6.5 50010 9552 16/06/2020 0.5 3.25 49334 8030 01/06/2020 0.5 4 49334 8030 02/06/2020 0.5 4 49334 8030 03/06/2020 0.5 4 49334 8030 04/06/2020 0.5 4 49334 8030 05/06/2020 0.5 4 49334 8030 06/06/2020 0.5 4 60012 8030 15/06/2020 0.5 3 60012 8030 16/06/2020 0.5 3
New View:
AbsenceID PersonID PeriodStart PeriodEnd TotalDays TotalHours 49334 9552 26/05/2020 29/05/2020 3 19 50000 9552 26/05/2020 29/05/2020 3 19 50010 9552 15/06/2020 16/06/2020 1.5 9.75 49334 8030 01/06/2020 06/06/2020 3 24 60012 8030 15/06/2020 16/06/2020 1 6