时间:2022-02-27 09:22:20 | 栏目:PostgreSQL | 点击:次
我就废话不多说了~
select name,price from odoo_sale;

select name,COALESCE(price, 0) from odoo_sale;

补充:postgresql查询某列的最大值时,对查询结果为空做默认为0的处理
实例如下:
select coalesce(max(max_grade),0)
from exam_grade
where examinee_id = 12345
and exam_id = 1;
查询某个考生在某个指定试卷的最高分,如果没有,则返回0