Hallo ihr beiden,
ihr seid schon nah dran gewesen:
SQL-Code:
SELECT P.Nr, PA.Firmname1, KH.FromDate
FROM KeyHistory KH
INNER JOIN Partner PA ON KH.Person = PA.ID
INNER JOIN Property P ON KH.Property = P.ID
WHERE KH.FromDate IN (
SELECT MAX(FromDate)
FROM KeyHistory
WHERE FromDate <= :today and property = P.ID
)
ORDER BY P.Nr
Grüße vom marabu