MySQL 版本: 5.7
id, article_id, comment_id, comment_at
1, 1, 1, 2024-09-13 14:32:39
2, 1, 2, 2024-09-13 14:32:39
3, 1, 3, 2024-09-13 14:32:30
4, 2, 4, 2024-09-13 14:32:30
articel_id, last_comment_id, last_comment_at
1, 2, 2024-09-13 14:32:39
2, 4, 2024-09-13 14:32:30
select article_id, max(concat(comment_at, '_', comment_id )) from xxx group by article_id