摘要: --函数 alter function xb ( @xingbie varchar(2) ) returns table as return ( select a.sex,SUM (b.score)as 总分,AVG(b.score)as 平均分 from stu3 as a full join stu4 as b on a .snum=b.cn... 阅读全文
posted @ 2018-11-30 17:12 新手上路,多多关照 阅读(854) 评论(0) 推荐(0) 编辑
摘要: alter function liejia ( @a int, @z int) returns int as begin declare @sum int while(@a<=@z) begin set @sum=isnull(@sum,0)+@a set @a=ISNULL(@a,0)+1 end return @sum e... 阅读全文
posted @ 2018-11-30 17:03 新手上路,多多关照 阅读(527) 评论(0) 推荐(0) 编辑
摘要: --函数 alter function zh() returns table as return( select 科目,max(张三) as 张三,max(李四)as 李四 from( select '语文'as 科目,张三,李四 from stu2 pivot(max(语文)for 姓名 in (科目,张三,李四))as a... 阅读全文
posted @ 2018-11-30 17:00 新手上路,多多关照 阅读(411) 评论(0) 推荐(0) 编辑