发新帖

[Postgresql] Postgresql使用coalesce实现类似oracle的NVL方法

零下一度 2020-1-31 918


coalesce(字段名,默认值),

The COALESCE function returns the first of its arguments that is not null. Null is returned only if all arguments are null. It is often used to substitute a default value for null values when data is retrieved for display, for example:

SELECT COALESCE(description, short_description, '(none)') ...
select coalesce(age,0) from users


最新回复 (0)
返回
零下一度
主题数
931
帖子数
0
注册排名
1