asp 统计数据库条数

来源:百度知道 编辑:UC知道 时间:2024/05/19 00:10:48
数据库字段如下:
id lb
1 上海
2 北京
3 上海
4 南京
5 北京

现在我就是要统计 上海,南京和北京各多少条记录
请问用asp怎么写?

Select Count(0),lb From Table Group By lb

Group By lb是分组的意思.这样就可以用了!!!

用三条查询语句分别查询出来吧
select count(id) from 表名 where lb='上海'
select count(id) from 表名 where lb='北京'
select count(id) from 表名 where lb='南京'
分别执行不就出来了 ?