支持排序的代码SELECT * , count( mid ) AS mid
FROM (
SELECT A.mid, A.title, A.sortrank, A.pubdate
FROM `acms_archives` AS A
LEFT JOIN `acms_arctype` AS B ON A.typeid = B.id
WHERE B.topid =18
AND A.arcrank =0
AND A.sortrank = A.pubdate
AND A.pubdate >0
ORDER BY pubdate DESC
) AS z
GROUP BY z.mid
ORDER BY z.pubdate DESC
LIMIT 0 , 7
原代码
SELECT A.title,A.sortrank,A.pubdate FROM `acms_archives` as A left join `acms_arctype` as B ON A.typeid = B.id where B.topid=18 and A.arcrank=0 and A.sortrank = A.pubdate and A.pubdate > 0 group by A.mid order by A.pubdate desc limit 0,7