The result is different because I am using different dates in my (new) table.
And yes, the last record is without enddate (in your query) but since it is contained in a (second) meta table, it is easy to join that and nvl(Thisdate, MetaDate) Enddate to get the right enddate.
Number of records indeed depends on the range, however the range here is going to be a convoluted process.
This is actually part of ETL that needs to happen on a daily basis, the batch gets touched on multiple levels in different ways some without a much needed change date in the source systems. Up to now we have chosen to refresh the entire table to make sure it reflects the current status in all ways possible. Yes this is postponing the inevitable, but for now it still works