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