郑州幼儿师范高等专科学校分数线:sql嵌套语句格式

来源:百度文库 编辑:神马品牌网 时间:2024/05/02 21:35:52
我想得到筛选后 某一列的sum值,请问如何使用嵌套语句得到,如:
sql="select * from DATA where 学校='"&school&"' and 类型="&id
sum="select sum(金额) from where (sql)"
系统提示语法错误

如何才能在sql筛选的范围内,求得金额列的值?
<%
sql="select * from DATA where 学校='"&school&"' and 类型="&id
set rs=Server.CreateObject("ADODB.Recordset")
rs.open sql,con,1,1
sum="select sum(金额) from IN (select * from DATA where 学校='"&school&"' and 类型="&id)

set a=con.execute(sum)
%>
无运行结果,还请各位大虾帮忙

select sum(金额) from where xx IN (select xx from DATA where 学校='"&school&"' and 类型="&id)

xx可以为任意字段

in sql,不是where(sql)