Probieren Sie es aus: SELECT ID, case when MAX(DATE IS NULL) = 0 THEN max(DATE) END AS DATE FROM test GROUP BY ID;