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