首页 > 其他分享 >group by 获取最新的数据

group by 获取最新的数据

时间:2023-06-02 13:14:46浏览次数:31  
标签:10 group ORDER 获取 最新 LIMIT WHERE id

SELECT
*
FROM
xxx AS t
WHERE
1 = 1
AND t.id IN (
select id FROM (
SELECT
MAX( t.id ) id
FROM
xxx AS t
WHERE
1 = 1
GROUP BY
t.id_number,
t.`class`
ORDER BY
t.id
LIMIT 0,
10 ) a
)
ORDER BY
t.id
LIMIT 0,
10

标签:10,group,ORDER,获取,最新,LIMIT,WHERE,id
From: https://www.cnblogs.com/wjsqqj/p/17451448.html

相关文章