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 =51
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
上一篇:C语言数组初始化全部为0


下一篇:windows 一个进程可以允许最大的线程数