,按计数排序。
例如,我有一行包含这些条目:
农业 </跨度> 能源 能源 环境 农业 </跨度> 矿业 能源
我希望我的查询返回给我:
能源 能源 能量 农业 </跨度> 农业 </跨度> 环境 矿业
我正在尝试这个:
SELECTcompanyname,id,location,industry,COUNT(industry)ASindio_occurrence来自atl3_atl_testimonials在哪里
companyname
id
location
industry
indio_occurrence
我希望你在这里寻找一个这样的人。
SELECT `companyname`, `id`, `location`, a.industry, cnt AS `industry_occurrence` FROM atl3_atl_testimonials a, (SELECT COUNT(`industry`) cnt, `industry` FROM atl3_atl_testimonials Group by industry) f WHERE state ='1' AND f.industry = a.industry ORDER BY cnt desc