开发者

using "in" with a case statement

Is it pos开发者_运维知识库sible to write something like

Case when a in (value1,value2) then b else a end


YES.

try it out with a simple query:

SELECT CASE WHEN 2 in (1,2) then 'B' ELSE 'A' END 

OUTPUT:

----
B

(1 row(s) affected)

then:

SELECT CASE WHEN 3 in (1,2) then 'B' ELSE 'A' END 

OUTPUT:

----
A

(1 row(s) affected)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜