oracle中decode()函数在mysql中怎么改啊,在线等!
例如在oracle中是这样写的:select
decode(length(POPEDOM),3,substr(POPEDOM,0,2),4,substr(POPEDOM,0,3),5,substr(POPEDOM,0,2),6,substr(POPEDOM,0,3),7,substr(POPEDOM,0,2),POPEDOM) as type
------解决方案--------------------MYSQL没用过,不过我想case when then应该也是支持的吧:
SELECT (CASE length(POPEDOM)
WHEN 3 THEN
substr(POPEDOM, 0, 2)
WHEN 4 THEN
substr(POPEDOM, 0, 3)
WHEN 5 THEN
substr(POPEDOM, 0, 2)
WHEN 6 THEN
substr(POPEDOM, 0, 3)
WHEN 7 THEN
substr(POPEDOM, 0, 2)
END) AS TYPE
FROM DUAL;