SQL语句两列值返回单值

时间:2016-04-13 08:36:59

标签: sql-server sql-server-2005 sql-server-2008-r2

请提出建议SQL语句的最佳方法,非常感谢!

example

1 个答案:

答案 0 :(得分:0)

试试这个

select id,[date],(case  when refund = 1 then 'R'
                        when voidstatus = 0 then 'C'
                        when  voidstatus = 1 then 'V'
                        else '' end
                ) as [status],grossamt
from    trans