I have data in an Ingres 10 table like the below :-
ref, from_date, to_date
A, 01/04/2016, 30/04/2016
A, 30/04/2016, 20/05/2016
A, 25/05/2016, 30/05/2016
B, 01/04/2016, 01/09/2016
B, 01/10/2016, 20/02/2016
The to_dates are exclusive-to.
So some sets of lines represent continuous periods with no gaps, these can span multiple lines, however sometimes there are gaps.
I need to count the days covered in each continuous period. I can't think of a way to do this.
So for ref A, I need to know that the first continuous period is 01/04/16 to 20/05/16 and there are 46 days in this period, and that the second continuous period is 25/05/16 - 30/05/16. and this is 4 days.