create table rtb_creatives (insert_date varchar(20), creative_id char(1), creative_object char(1));
insert into rtb_creatives (insert_date, creative_id, creative_object) values
('june 12', 'a', 'b'),
('june 13', 'a', 'b'),
('june 12', 'c', 'd'),
('june 13', 'c', 'd')
;
SELECT insert_date, creative_id, creative_object
from rtb_creatives
where
adgroup_id='agid1608844879'
and is_delete in (0)
and insert_date = (select max(insert_date) from rtb_creatives)
group by insert_date, creative_id, creative_object
;
+
| insert_date | creative_id | creative_object |
+
| june 13 | a | b |
| june 13 | c | d |
+
source
share