[b]SQL分组、统计、排序的查询:[/b]
[b]还不知道怎么用“order by”来排序,像下面这样就会报错:[/b]
环境:MySQL5.0
SELECT count( id ) cnt, category, computername
FROM `computer`
WHERE (
category = 'notebook'
OR category = 'desk-top'
)
GROUP BY computername ASC
LIMIT 0 , 100
[b]还不知道怎么用“order by”来排序,像下面这样就会报错:[/b]
SELECT count( id ) cnt, category, computername
FROM `computer`
WHERE (
category = 'notebook'
OR category = 'desk-top'
)
ORDER BY computername
GROUP BY computername
LIMIT 0 , 100
环境:MySQL5.0