查询问题

fengwei19823 2009-08-27 11:44:54
表如下,请问如何一次查询出每个员工 初步联系,预约看场, 已看场有意向, 已看场不考虑, 签约客户 的数量

并在页面中显示

name(姓名) cus_name(客户名) cus_state(客户状态)
张三 肯德基 初步联系
张三 按时的 预约看场
张三 翻跟斗 预约看场
张三 粗色的 初步联系
张三 粗豆腐干的 签约客户
小刘 挥洒的 已看场有意向
小刘 士大夫 已看场不考虑
小刘 gf的 已看场不考虑
小刘 搞活风格 已看场不考虑
王五 反对感发 签约客户
王五 环境燃放法 签约客户
王五 我日的感发 签约客户
王五 地方搞活 初步联系
...全文
74 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
number123456 2009-08-28
  • 打赏
  • 举报
回复
sql = "select name, count(cus_state) as counts,cus_state from table group by name, cus_state order by name"
rs.open sql,conn,1,1
while not rs.eof
Response.write rs("name") & " " & rs("cus_state") & " " & rs("counts") & "次<br>"
rs.movenext
wend
rs.close
BlueSky4014 2009-08-27
  • 打赏
  • 举报
回复
每天回帖即可获得10分可用分!
fengwei19823 2009-08-27
  • 打赏
  • 举报
回复
10楼 你没明白我想查什么
cfjun 2009-08-27
  • 打赏
  • 举报
回复
错了上面的 rs7.movenext改成rs.movenext
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from 表名"
rs.Open sql, conn, 1, 1
do while not rs.eof
response.write rs("name")&vbcrlf
rs.movenext
loop
rs.close
set rs =nothing
cfjun 2009-08-27
  • 打赏
  • 举报
回复
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from 表名"
rs.Open sql, conn, 3, 3
do while not rs.eof
response.write rs("name")&vbcrlf
rs7.movenext
loop
rs.close
set rs =nothing
fengwei19823 2009-08-27
  • 打赏
  • 举报
回复
做了循环 但是提示至少有一个参数没有赋值` 但我查看表没空字段
<%
strsql7 ="select count(*), name, cus_state from cus group by name, cus_state order by name, cus_state "
Set rs7 = Server.CreateObject("ADODB.Recordset")
rs7.Open strsql7, conn, 3, 3
do while not rs7.eof
%>
<tr align="center">
<td><%=rs7("name")%></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<%rs7.movenext
loop
%>
</table>
<%
rs7.close
set rs7 =nothing%>
fengwei19823 2009-08-27
  • 打赏
  • 举报
回复
楼上

提示: 对象不支持此属性或方法: 'Open'

shenzhenNBA 2009-08-27
  • 打赏
  • 举报
回复
sql="SELECT [name],cus_state, count(cus_state) as [state_num] from table group by cus_state"
Dogfish 2009-08-27
  • 打赏
  • 举报
回复
循环显示。

[Quote=引用 2 楼 fengwei19823 的回复:]
如何显示在页面上呢

[/Quote]
shenzhenNBA 2009-08-27
  • 打赏
  • 举报
回复
用RS数据集接受

<%
...数据库连接(省)...
dim RS,sql
sql="select count(*), name, cus_state from table group by name, cus_state
order by name, cus_state"
RS=server.createobject("adodb.recordset")
RS.open sql,DBconn,1,1
...
%>
number123456 2009-08-27
  • 打赏
  • 举报
回复
SELECT count(cus_state),cus_state from table group by cus_state
fengwei19823 2009-08-27
  • 打赏
  • 举报
回复
如何显示在页面上呢
Dogfish 2009-08-27
  • 打赏
  • 举报
回复
select count(*), name, cus_state from table group by name, cus_state
order by name, cus_state
liangwenfang 2009-08-27
  • 打赏
  • 举报
回复
select name, count(cus_state) from table group by name, cus_state
order by name, cus_state
黑心 2009-08-27
  • 打赏
  • 举报
回复
sql="SELECT max(name),cus_state, count(cus_state) as [state_num] from table group by cus_state"

28,405

社区成员

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

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