没有多少分了!
如果我要判断表中一个字段为"yes"的在表中占多少比率要怎么实现呀!!!!
请贴出代码!
如果我要判断表中一个字段为"yes"的在表中占多少比率要怎么实现呀!!!!
请贴出代码!
比如我要判断的字段名字为a
rs.movefirst
dim i
dim j
j=0
for i=1 to rs.recordcount
if rs(a)="yes" then
j=j+1
end if
rs.movenext
next
后面select count(a) as b from 表
dim c
c=cdbl(j)/cdbl(rs(b))
response.write c
上面可行,效率不计的话!
select count(id)/(select count(id) from table) from table where 字段='yes'
用rs(0)得到结果
好象要用两句sql的。
select count(*) as cnt from table
select count(*) as cnt1 from table where field='yes'
rs("cnt")/rs1("cnt1")
一句就够了