我想知道是否有办法选择一列,但根据其值更改结果。例如,如果结果在1到5之间,则显示为“ 1-5”
我看过网上,似乎只能找到只选择该组数据的方法,但我需要保留整个结果。
答案 0 :(得分:1)
像这样吗?
select
case
when [column_name] between 1 and 5
then '1-5'
when [column_name] between 6 and 10
then '6-10'
when [column_name] between 11 and 15
then '11-15'
else ''
end as [new_column_name]
from
[table_name]