我们一步一步来吧!
1:假设部份代码为:18
2:用SELECT语句查出部门代码为18的主机号!
SELECT * FROM BASEPHONE WHERE DEPARCODE = '18'
这样便得出了该部门的所有号码。
3: 再用一个循环读出该部们的每个主机号。因为可能不只一个!
while not rs.eof
wend
4: 在3步的循环中,我们要找以每一个号码对应的通话费
while not rs.eof
strSQL = "select sum(netfree) as netf from call1 where call = "&rs("phone")&""
rs2.open strSQL,conn,1,1
PhoneCount = rs2("netf") +rs("setrent") 這一步是將月租和發生的費用想加起來
response.write rs("phone")&"本月話費合計:"&phoneCount&"
"
rs.movenext
我只是粗略的看了一下。应该也差不多了吧!!
嘻嘻。。。
wend
response.end