请教一个简单的sql语句!(在线等......)

mjb001 2003-09-29 07:47:37
请帮我写一循环语句:
1、将tbdh为001的所有记录统计出来,并赋给一个变量a
2、写一个for语句,如:
for(int i=0; i<a;i++)
{sql语句}
请帮我写一完整的出来!

...全文
44 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
benququer 2003-09-29
  • 打赏
  • 举报
回复
set rs=server.create("ADODB.Recordset")
sql="select count(*) as count from table where tbdh='001'
rs.open sql,conn,adopenstatic
a=rs("count")
syandy 2003-09-29
  • 打赏
  • 举报
回复
又错了重来
select count(*) into :a from table where tbdh='001'
要先定义a
syandy 2003-09-29
  • 打赏
  • 举报
回复
以上语句中的form 错了,改一下
syandy 2003-09-29
  • 打赏
  • 举报
回复
select count(*) into a form table where tbdh='001'
lincoke 2003-09-29
  • 打赏
  • 举报
回复
set rs=conn.execute("select count(*) as all from table where tbdh='001'")
a=rs("all")就可以了,不用循环

kevin_gao 2003-09-29
  • 打赏
  • 举报
回复
select count(*) as a from table where tbdh='001'
?

不知道是不是你说的意思。 :)

28,390

社区成员

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

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