declare @fff varchar(50)
declare @ddd int
select @ddd = 20
SELECT @fff =
CASE
WHEN @ddd < 10 THEN '小于10'
WHEN @ddd > 10 and @ddd < 20 THEN '10到20之间'
WHEN @ddd > 20 and @ddd < 30 THEN '20到30之间'
WHEN @ddd > 30 and @ddd < 40 THEN '30到40之间'
WHEN @ddd > 40 and @ddd < 50 THEN '30到40之间'
ELSE '10,20,30,40,50'
END
select @fff