岛国毛片,欧美性生交xxxxxoo,日韩欧美系列中文字幕第五页,国产精品毛片大码女人

中山php|最優(yōu)網(wǎng)絡中山做網(wǎng)站 中山php建站

最優(yōu)良人

2011/08/14 at 02:29

Mysql查詢數(shù)據(jù)表中某字段重復出現(xiàn)的次數(shù),并按照次數(shù)排序

利用Mysql中的 的聚合函數(shù) count(*) 可以實現(xiàn)這個功能,例如需要查詢data表中name出現(xiàn)次數(shù)最多的記錄,可以先按照group by name分組,用count算出分組里的條數(shù),再按照count排序:

select name,count(*) from data group by name order by count(*) DESC limit 1

不加limit限制將返回按照name重復次數(shù)排列的數(shù)據(jù)

標簽:,
-