Maybe like this:
(html, codepage is 1252, embedded labels, table is @1);
NOCONCATENATE LOAD Employee, Department, StartDate,
if(Employee=peek(Employee) and EndDate=peek(StartDate),Date(EndDate-1),EndDate) as EndDate
resident INPUT order by Employee, StartDate desc;
drop table INPUT;
It will order your table by Employee and StartDate descending, i.e. backwards in time.
Then check in every line if the Employee is identical to the previous line and if the EndDate is identical to the StartDate of the previous line (remember, previous line is forward in time). Then correct the EndDate by subtracting one day.
See also attached,
comm51964.qvw 147.0 K