SQL: 筛选栏位唯一值,并按另一栏位排序

筛选出来message中的所有唯一name,并按照创建的最大时间排序,列出解法:

SELECT name, MAX(created_at) AS max_created_at
FROM messages
GROUP BY name
ORDER BY max_created_at DESC;