使用选择查询替换结果集中的值

时间:2013-09-07 09:24:27

标签: sql

如何在使用单选查询选择时,在表格中分别用“男性”和“女性”替换值1和2?

Name     Gender
a         1
a         2

1 个答案:

答案 0 :(得分:6)

select  Name
,       case Gender
        when 1 then 'Male'
        when 2 then 'Female'
        end as Gender
from    YourTable
相关问题