学习SQL日记--case a when 1 then x when 2 then y else a end

来源:互联网 发布:开源微信微商城源码 编辑:程序博客网 时间:2024/04/30 05:37

declare @table table (a varchar(2),b varchar(2))
insert into @table
select 'cc','a1' union all
select 'cc','b2'

select a,case when a='cc' and b='a1' then 'b5' else b end as b from @table

/*
a    b
---- ----
cc   b5
cc   b2
*/

 

2011-05-05

http://topic.csdn.net/u/20110504/13/2cb2b395-4ea4-462a-a22f-d78c9251bd26.html

原创粉丝点击