考试成绩统计问题:
msyyq 2009-08-04 04:27:22 考试成绩统计问题:
如果成绩表(c2cj)中存在化学科(HX)成绩,则计算平均分,否则@temhxpj为0分,但是用下面语句总中提示
“服务器: 消息 207,级别 16,状态 3,行 14
列名 'hx' 无效。”
DECLARE @temhxpj decimal(4,1)
if exists(select 1 from syscolumns where id=object_id('c2cj') and name='hx')
select @temhxpj=round(avg(hx),2) from mydata.dbo.c2cj
select @temhxpj=0
问题出在哪里?