获取同一个人最新提交记录

`
-- (1) limit 不加无效
SELECT applyer, applydate, workno FROM (SELECT applyer, applydate, workno FROM uf_vaccination ORDER BY applydate DESC LIMIT 10000) t GROUP BY t.applyer

-- (2) max() 函数
SELECT * FROM uf_vaccination td,(SELECT max(id) id FROM uf_vaccination GROUP BY applyer) md where td.id = md.id;

-- (3) where in
SELECT * FROM uf_vaccination WHERE id IN (SELECT MAX(id) FROM uf_vaccination GROUP BY applyer);

`

posted @ 2022-03-02 09:11  北方有鱼  阅读(22)  评论(0编辑  收藏  举报