SQL: Group data when a value will be repeated for a ID and create a gapless date range
I would like to group data from a sql table as long as the value "TreatDataTableInfo" will not change. And I would link to use the oldest date from the group as the "FromDate" and the date from the next group/next data record with different "TreatDataTableInfo" -1day as the "ToDate". So in the end the groups should have a gap in the date range. Please check the screenshot for a example. I have highlighted two grouping examples.
I have tried to solve this problem by using sql (group by) and by using QlikView Load statements with peek() and so, but I can not find a solution.