读书人

Postgresql有没有判断语句呀?该如何解

发布时间: 2012-02-23 22:01:34 作者: rapoo

Postgresql有没有判断语句呀?
Postgresql有没有判断语句呀?

[解决办法]
The example above can be written using the simple CASE syntax:

SELECT a,
CASE a WHEN 1 THEN 'one '
WHEN 2 THEN 'two '
ELSE 'other '
END
FROM test;

a | case
---+-------
1 | one
2 | two
3 | other

读书人网 >Mysql

热点推荐