MySql分组排序取时间最⼤的⼀条记录SELECT A.* FROM digital_asset A,
(SELECT name, max(last_updated) max_day FROM digital_asset GROUP BY name) B
WHERE A.name = B.name AND A.last_updated = B.max_day
SELECT A . *
FROM bbs_threads A, (
SELECT digest, max( dateline ) max_dateline
FROM bbs_threads
WHERE fid =51mysql group by order by
AND digest >0
AND displayorder >=0
GROUP BY digest
ORDER BY max_dateline
)B
WHERE A.digest = B.digest
AND A.dateline = B.max_dateline
LIMIT 0 , 20
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论