Nur mal laut gedacht:
SQL-Code:
Select Basis.*,
( Select Min(B2.Datum) From Buchungen B2 Where B2.PersonID=Basis.PersonID
AND B2.Datum>=Basis.Datum AND B2.Datum+1 not in
(Select Datum From Buchungen Where PersonID=B2.PersonID)
) as Endedatum
From
(
Select
B.PersonID, P.Name, B.Datum as Startdatum
From
Buchungen B
Left Join
Personen P
On P.ID=B.PersonID
Where B.Datum-1 not in (Select Datum From Buchungen Where PersonID=B.PersonID
) Basis
Order By 1,2
Wenn man in der ersten Where Clausel
Basis.Datum
mit
Basis.Startdatum
ersetzt, dann funzt das in der Tat.