图片如下:
我想计算ncomid=1, bgood=1的总数减去ncomid=1, bgood=2总数的值
写了下面的程序,总提示不正确谁来帮我!!
set rs_good=server.createobject("adodb.recordset")
sql_good="select nComId,count(bGood) as totals1 from appraisal where bGood=1 group by nComId "
rs_good.open sql_good,mConn,1,1
if not rs_good.eof then
Good=rs_good("totals1")
'response.write rs_good("totals1")
'response.end
else
Good=0
end if
set rs_bad=server.createobject("adodb.recordset")
sql_bad="select nComId,count(bBad) as totals2 from appraisal where bGood=2 group by nComId "
rs_bad.open sql_bad,mConn,1,1
if not rs_bad.eof then
Bad=rs_bad("totals2")
else
Bad=0
end if
Source=Good-Bad