SQLServer2005 CASE WHEN在项目中实例-查询显示值替换

1.利用SqlServer中的case when来把数据查询出来的数据替换成其它值显示

2.结果对比:

 普通select查询出来的结果如下:

 用了case when方法后显示结果如下:

 

3.具体使用代码如下:

select cInvCode,cValueType,
    case 
        when cValueType='全月平均法'  then 'S'
        when cValueType='计划价法'  then 'J'
        else ''
    end as cValueType
,isnull(iInvRCost,0) from Inventory


 作者:王春天 2013.11.11 地址:http://www.cnblogs.com/spring_wang/p/3418061.html

原文地址:https://www.cnblogs.com/spring_wang/p/3418061.html