asp:查询每个学生的各科成绩,总分,平均分的sql语句
只有一个score表,字段是: xjh name zuohao xueke scoreL001 张三 01 语文 65
L002 李四 02 数学 85
L001 张三 01 数学 75
L002 李四 02 语文 55
我想要的结果是: xjh name zuohao yuwen shuxue zongfen pjf
L001 张三 01 65 75 140 70
L002 李四 02 55 85 140 70
下面是我的sql语句:
dim rs,sql,sql2,zt,ck,nf,xq,cx,bj,bjmc,info
nf="2016"
xq="春季学期"
cx="期中考试"
bjmc="小学2012级3班"
set rs=server.CreateObject("Adodb.Recordset")
sql="select zuohao,name,xjh,"
sql=sql&"sum(case when xueke='语文' then score else 0 end) as yuwen,"
sql=sql&"sum(case when xueke='数学' then score else 0 end) as shuxue,"
sql=sql&"sum(case when xueke='英语' then score else 0 end) as yingyu,"
sql=sql&"sum(case when xueke='综合' then score else 0 end) as zhonghe,"
sql=sql&"sum(score) as zongfen,"
sql=sql&"sum(score)*1.0/4 as pjf"
sql=sql&" from score where nianfen='"&nf&"' and xueqi='"&xq&"' and cixu='"&cx&"' and bjmc='"&bjmc&"' group by zuohao,name,xjh order by desc zongfen"
rs.open sql,conn,1,1
提示错误:错误 '80004005' ,/StudentScore.asp,行 92 (注:92行就是:rs.open sql,conn,1,1)
怎么办啊?谢谢大虾