इसे आज़माएं: SELECT ID, case when MAX(DATE IS NULL) = 0 THEN max(DATE) END AS DATE FROM test GROUP BY ID;