Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要根据它们的最近/最后从 db 中获取所有不同的值entryModTime。
entryModTime
您的理解
id entry_modtime 3 13-12-1977 3 14-12-1977 4 13-12-1977 5 13-12-1977 2 13-12-1977 3 15-12-1977
上表中的id字段不是主要的。我需要从该表中获取所有数据,因此输出应该是,
id
3 15-12-1977 4 13-12-1977 5 13-12-1977 2 13-12-1977
您可以group围绕您的id并选择每个日期的最高id日期max()
group
max()
select id, max(entry_modtime) as latest_entry_modtime from your_table group by id
select id, max(entry_modtime) from your_table group by id