Home >Database >Mysql Tutorial >SQL编程:统计n次考试的成绩

SQL编程:统计n次考试的成绩

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 16:20:501326browse

USE [new_wzjw] GO /****** Object: StoredProcedure [dbo].[成绩管理_过程化成绩录入_统计最终成绩] Script Date: 2014/4/1 19:22:01 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER proc [dbo].[成绩管理_过程化成绩录入_统计最终成绩]

USE [new_wzjw]

GO

/****** Object:  StoredProcedure [dbo].[成绩管理_过程化成绩录入_统计最终成绩]    Script Date: 2014/4/1 19:22:01 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

ALTER proc [dbo].[成绩管理_过程化成绩录入_统计最终成绩]

@kcid jxrw_code

as begin

 

declare c1 cursor for

 

select zzcj.cj,zzcj.xh from

(select xh from web_inputCj_cjb where kcId=@kcid)xsxx

left join

(select xh,round(sum(cjbl*0.01*isnull(cj,0)),0)cj from web_inputCj_xscjb xscjb left join

 

(select ksid,cjbl from web_inputCj_xsksb where kcId=@kcid)ksxx

 

 on xscjb.ksid=ksxx.ksid group by xh

)zzcj on zzcj.xh=xsxx.xh

 

declare @cj float

declare @xh varchar(12)

 

open c1

 

fetch c1 into @cj,@xh

while @@FETCH_STATUS = 0

 

begin

update web_inputCj_cjb set cj=@cj  where xh=@xh and kcId=@kcId

 

fetch c1 into @cj,@xh end

 

end

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn