clear markdown feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3799213 fiddles created (41756 in the last week).

CREATE TABLE test ( email VARCHAR(13), carrier VARCHAR(10), id INTEGER, d_date TIMESTAMP ); INSERT INTO test (email, carrier, id, d_date) VALUES ('email_1', 'car_1', '1', '2019-02-08'), ('email_1', 'car_1', '1', '2019-02-09'), ('email_1', 'car_1', '2', '2019-02-10'), ('email_1', 'car_2', '2', '2019-02-11'), ('email_2', 'car_3', '3', '2019-02-09'), ('email_2', 'car_4', '4', '2019-02-09'); SELECT * FROM test;
email carrier id d_date
email_1 car_1 1 2019-02-08 00:00:00
email_1 car_1 1 2019-02-09 00:00:00
email_1 car_1 2 2019-02-10 00:00:00
email_1 car_2 2 2019-02-11 00:00:00
email_2 car_3 3 2019-02-09 00:00:00
email_2 car_4 4 2019-02-09 00:00:00
 hidden batch(es)


SELECT email, carrier, id, MIN(d_date) AS date FROM test GROUP BY email, carrier, id
email carrier id date
email_1 car_1 1 2019-02-08 00:00:00
email_1 car_1 2 2019-02-10 00:00:00
email_1 car_2 2 2019-02-11 00:00:00
email_2 car_3 3 2019-02-09 00:00:00
email_2 car_4 4 2019-02-09 00:00:00
 hidden batch(es)