Let me try to explain this again.
This table has a record for each person for each day of the month. There are approx 20 fields in the table. If any of the fields change (other than the date fields), then I want to group those records. So, for example, if days 1, 2, & 3 are the same, then when I read in day 4 and notice that it is changed, I want to group days 1, 2, & 3 together with a begindate of day one, and an enddate of day 3...etc
Rownum ID BegDate EndDate Field1, Field2.... Field20
1 1 6/1/2017 6/1/2017 xxxx xxxx xxxxx
2 1 6/2/2017 6/2/2017 xxxx xxxx xxxxx
3 1 6/3/2017 6/3/2017 xxxx xxxx xxxxx
4 1 6/4/2017 6/4/2017 yyyy yyyy yyyy
5 1 6/5/2017 6/5/2017 yyyy yyyy yyyy
6 1 6/6/2017 6/6/2017 xxxx xxxx xxxxx
7 1 6/7/2017 6/7/2017 xxxx xxxx xxxxx
8 1 6/8/2017 6/8/2017 zzzz zzzz zzzz
....
So in the example data above, I would have a group with rows 1,2,3 then a group with rows 4,5 then a group with rows 6,7 then a group with 8...etc
ID BegDate EndDate Field1 Field2 ...... Field20 Sum
1 6/1/2017 6/3/2017 xxxx xxxx xxxxx 3
1 6/4/2017 6/5/2017 yyyy yyyy yyyy 2
1 6/6/2017 6/7/2017 xxxx xxxx xxxxx 2
1 6/8/2017 6/15/2017 zzzz zzzz zzzz 8
.....