使用case… when 语法来操作,when后的条件可以是某个值,也可以是表达式
-- 条件是具体的值 select case col_name1 when 1 then '别名1' when 2 then '别名2' else '别名3' end col_name1, col_name2 from table_name -- 条件是表达式 select case col_name1 when col_name1 <1000 then '别名1' when col_name1 <2000 then '别名2' else '别名3' end col_name1, col_name2 from table_name



