views:

53

answers:

1

Hi

Is it possible to write something like

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

+9  A: 

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)
KM
+1: nice clean example
RedFilter