--多行合并一行
CREATE FUNCTION dbo.fn_Sum(@code varchar(50))
RETURNS varchar(8000)
AS
BEGIN
DECLARE @values varchar(8000)
SET @values = ''
SELECT @values = @values + ',' + CourseType FROM CourseType WHERE CourseType=@code
ORDER BY level asc
RETURN STUFF(@values, 1, 1, '')
END