create procedure xh
@xh char(11),
@姓名 char(20) out,
@课程数 int out,
@总周学时 int out,
@总学分数 int out,
@jq int out
as
select 姓名,@课程数=count(yzhp_grade.课程代号),总周学时=sum(周学时),总学分数=sum(学分),
@jq=sum(学分*(yzhp_grade.平时*0.1+yzhp_grade.期中*0.2+yzhp_grade.期末*0.7))/sum(学分)
from yzhp_course,yzhp_grade,yzhp_student
where yzhp_student.学号=@xh
and yzhp_grade.课程代号=yzhp_course.课程代号
and yzhp_grade.学号=yzhp_student.学号
group by 姓名消息 141,级别 15,状态 1,过程 xh,第 9 行
向变量赋值的 SELECT 语句不能与数据检索操作结合使用。
这个问题怎么解决?
@xh char(11),
@姓名 char(20) out,
@课程数 int out,
@总周学时 int out,
@总学分数 int out,
@jq int out
as
select 姓名,@课程数=count(yzhp_grade.课程代号),总周学时=sum(周学时),总学分数=sum(学分),
@jq=sum(学分*(yzhp_grade.平时*0.1+yzhp_grade.期中*0.2+yzhp_grade.期末*0.7))/sum(学分)
from yzhp_course,yzhp_grade,yzhp_student
where yzhp_student.学号=@xh
and yzhp_grade.课程代号=yzhp_course.课程代号
and yzhp_grade.学号=yzhp_student.学号
group by 姓名消息 141,级别 15,状态 1,过程 xh,第 9 行
向变量赋值的 SELECT 语句不能与数据检索操作结合使用。
这个问题怎么解决?
@xh char(11),
@姓名 char(20) out,
@课程数 int out,
@总周学时 int out,
@总学分数 int out,
@jq int out
as
select
@姓名=姓名,
@课程数=count(yzhp_grade.课程代号),
@总周学时=sum(周学时),
@总学分数=sum(学分),
@jq=sum(学分*(yzhp_grade.平时*0.1+yzhp_grade.期中*0.2+yzhp_grade.期末*0.7))/sum(学分)
from yzhp_course,yzhp_grade,yzhp_student
where yzhp_student.学号=@xh
and yzhp_grade.课程代号=yzhp_course.课程代号
and yzhp_grade.学号=yzhp_student.学号
group by 姓名
@xh char(11)
as
select 姓名,课程数=count(yzhp_grade.课程代号),总周学时=sum(周学时),总学分数=sum(学分),
jq=sum(学分*(yzhp_grade.平时*0.1+yzhp_grade.期中*0.2+yzhp_grade.期末*0.7))/sum(学分)
from yzhp_course,yzhp_grade,yzhp_student
where yzhp_student.学号=@xh
and yzhp_grade.课程代号=yzhp_course.课程代号
and yzhp_grade.学号=yzhp_student.学号
group by 姓名