group by max(Datum) und Count und vergleich mit 2ter tabelle