create function uu() returns varchar(8000)
as
begin
declare @x numeric(8,2), @y numeric(8,2)
declare @str varchar(1000)
set @x=(select avg(zhi) from ttt where seq=11)
set @y=(select avg(zhi) from ttt where seq=12)
if (@x> @y)
set @str= '部门 10 平均工资高于部门 20'
else
set @str= '部门 10 平均工资低于部门 20'
return (@str)
end
本文介绍了一个SQL函数createfunctionuu,该函数用于比较两个部门(部门10与部门20)的平均工资,并返回相应的比较结果。
184

被折叠的 条评论
为什么被折叠?



