Maison > base de données > tutoriel mysql > SQL编程:统计n次考试的成绩

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Libérer: 2016-06-07 16:20:50
original
1328 Les gens l'ont consulté

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

Étiquettes associées:
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal