SQL分组、统计、排序的查询
程序员文章站
2022-06-05 09:18:22
...
[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
上一篇: thinkPHP删除前弹出确认框的简单实现方法_php实例
下一篇: php之aop实践