sql怎么统计某字段相同的记录数?

cnljc 2009-05-14 01:11:38
access某表中多条记录,比如有一字段sheng是地区(北京,上海,河北等30多个省),在sql中怎么统计出地区是北京的记录数?
...全文
473 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Msxindl_Com 2009-05-14
  • 打赏
  • 举报
回复
第一种: select count(*) as sl from table where sheng='北京'
.....
response.write(rs("sl"))
.....

第二种: select * from table where sheng='北京'
.....
response.write(rs.recordcount)
.....
Msxindl_Com 2009-05-14
  • 打赏
  • 举报
回复
第一种: select count(*) as sl from table where sheng='北京'
.....
response.write(rs("sl"))
.....
第二种: select * from table where sheng='北京'
.....
response.write(rs.recordcount)
.....

lzp4881 2009-05-14
  • 打赏
  • 举报
回复
select count(*) as sl from table where sheng='北京'
uem117 2009-05-14
  • 打赏
  • 举报
回复
纯SQL我不知道,但是我觉得可以用SELECT先选出所有的北京的记录,然后遍历这个集合,用个计数器+1,然后用rd.movenext,最后读你的计数器

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧