ASP如何实现数据的加减乘除运算

来源:百度知道 编辑:UC知道 时间:2024/06/26 04:02:04
求助
如:<%=rs("title")%>为日期,每天产量为<%=rs("title2")%>,搜索title日期为2008-5有N条,
求:2008-5的总产量、2008-5的平均值,
望前辈赐教!!!

'此处不需要进行运算,直接使用SQL 语句获取数据即可

'总产量
TEMP1=Conn.execute("Select Sum(title2)from [产量表] where title='2008-5'")(0)
if isnull(temp1) then temp1=0 end if

'平均
TEMP2=Conn.execute("Select Avg(title2)from [产量表] where title='2008-5'")(0)
if isnull(temp2) then temp2=0 end if