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)
精彩评论