首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

pgsql的Case when的小疑点

2012-03-02 
pgsql的Case when的小问题!case aaa when 1 then a when 2 then b when in (3,4) then celse d en

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'
[解决办法]
分开写

热点排行