ASP中读取两个不同表的数据并相乘该如何实现?
我是这样写的:<%setrs3=server.createobject("adodb.recordset")sql1="selectsum(in_money_yu)fro...
我是这样写的:
<%
set rs3 = server.createobject("adodb.recordset")
sql1="select sum(in_money_yu) from info_all where user_id = 75"
sql2="select money from user_info where user_id = 75"
rs3.open sqlb ,conn,1,1
rs3.open sqlc ,conn,1,1
if rs3("in_money_dl")>0 then
mm1=rs3("in_money_dl")
mm2=rs3("mbit")
mm3=mm2*mm1
else
mm3=0
end if
response.Write mm3
rsb.close%>
明显这个错了,请问正确的应该怎么写啊? 展开
<%
set rs3 = server.createobject("adodb.recordset")
sql1="select sum(in_money_yu) from info_all where user_id = 75"
sql2="select money from user_info where user_id = 75"
rs3.open sqlb ,conn,1,1
rs3.open sqlc ,conn,1,1
if rs3("in_money_dl")>0 then
mm1=rs3("in_money_dl")
mm2=rs3("mbit")
mm3=mm2*mm1
else
mm3=0
end if
response.Write mm3
rsb.close%>
明显这个错了,请问正确的应该怎么写啊? 展开
2个回答
展开全部
set rs1 = server.createobject("adodb.recordset")
set rs2 = server.createobject("adodb.recordset")
sql1="select sum(in_money_yu)as in_money_dl from info_all where user_id = 75"
sql2="select sum(money) as mbit from user_info where user_id = 75"
rs1.open sql1 ,conn,1,1
rs2.open sql2 ,conn,1,1
if rs1("in_money_dl")>0 and rs2("mbit")>0 then
mm3=rs1("in_money_dl")*rs2("mbit")
else
mm3=0
end if
response.Write mm3
rs1.close
rs2.close
set rs2 = server.createobject("adodb.recordset")
sql1="select sum(in_money_yu)as in_money_dl from info_all where user_id = 75"
sql2="select sum(money) as mbit from user_info where user_id = 75"
rs1.open sql1 ,conn,1,1
rs2.open sql2 ,conn,1,1
if rs1("in_money_dl")>0 and rs2("mbit")>0 then
mm3=rs1("in_money_dl")*rs2("mbit")
else
mm3=0
end if
response.Write mm3
rs1.close
rs2.close
展开全部
<%
set rs1 = server.createobject("adodb.recordset")
set rs2 = server.createobject("adodb.recordset")
sql1="select sum(in_money_yu)as in_money_dl from info_all where user_id = 75"
sql2="select sum(money) as mbit from user_info where user_id = 75"
rs1.open sql1 ,conn,1,1
rs2.open sql2 ,conn,1,1
if rs1("in_money_dl")>0 and rs2("mbit")>0 then
mm1=rs1("in_money_dl")
mm2=rs2("mbit")
mm3=mm1*mm2
else
mm3=0
end if
response.Write mm3
rsb.close%>
set rs1 = server.createobject("adodb.recordset")
set rs2 = server.createobject("adodb.recordset")
sql1="select sum(in_money_yu)as in_money_dl from info_all where user_id = 75"
sql2="select sum(money) as mbit from user_info where user_id = 75"
rs1.open sql1 ,conn,1,1
rs2.open sql2 ,conn,1,1
if rs1("in_money_dl")>0 and rs2("mbit")>0 then
mm1=rs1("in_money_dl")
mm2=rs2("mbit")
mm3=mm1*mm2
else
mm3=0
end if
response.Write mm3
rsb.close%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询