mysql分組后組內(nèi)排序 mysql先排序后分組?
mysql先排序后分組?用分組函數(shù)來做,假如你的表名是table_nameselect A.*from table_name A,(select product,max(date) max_date
mysql先排序后分組?
用分組函數(shù)來做,假如你的表名是table_nameselect A.*from table_name A,(select product,max(date) max_date from table_name group by product) Bwhere A.product=B.product and A.date=B.max_date
Mysql分組并排序?
1、按rowno分組后,每個rowno只有一條數(shù)據(jù)。所以排序不可能同時按rowno, count來排序。
2、感覺你應該只按count排序
------------------
SELECT rowno
,COUNT(*) AS Num
FROM Table1
GROUP BY rowno
ORDER BY COUNT(*)