日期:2014-05-16  浏览次数:20884 次

pgsql的Case when的小问题!
case aaa when 1 then 'a' when 2 then 'b' when in (3,4) then 'c'else 'd' end

红色的部分对吗?如果不对该怎么写呢?


谢谢!

------解决方案--------------------
case when aaa=1 then 'a' when aaa=2 then 'b' when aaa in (3,4) then 'c'else 'd' end

------解决方案--------------------
只能拆开写。
when 3 then 'c' when 4 then 'c'
------解决方案--------------------
分开写