我有一个模式如下:
CREATE TABLE fruit ( name TEXT, date_collected TEXT);
数据:
INSERT INTO fruit (name, date_collected) VALUES ('red apples', '2020-02-04 08:04:37+00:00');
INSERT INTO fruit (name, date_collected) VALUES ('red apples', '2020-06-01 04:36:09+00:00');
INSERT INTO fruit (name, date_collected) VALUES ('mangoes', '2020-03-18 19:14:24+00:00');
INSERT INTO fruit (name, date_collected) VALUES ('mangoes', '2017-04-20 19:14:24+00:00');
INSERT INTO fruit (name, date_collected) VALUES ('watermelon', '2019-12-20 14:29:02+00:00');
如何选择只按日期显示最新不同水果条目的输出?
例如
red apples | 2020-06-01 04:36:09+00:00
mangoes | 2020-03-18 19:14:24+00:00
watermelon | 2019-12-20 14:29:02+00:00
2条答案
按热度按时间ftf50wuq1#
如果只需要最长日期,请使用聚合:
ugmeyewa2#
这应该适合您: