PostgreSQL将空值变为零 [英] Postgresql turn null into zero
本文介绍了PostgreSQL将空值变为零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Possible Duplicate:
SELECT max(x) is returning null; how can I make it return 0?
执行时
select max(column) from mytable;
并且我的表没有行,它返回null.如何修改此选择语句,使其返回零?
and my table has no rows, it returns null. How can I amend this select statement so it will return zero?
推荐答案
select coalesce(max(column), 0) from mytable;
这篇关于PostgreSQL将空值变为零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文