【发布时间】:2012-11-27 13:25:08
【问题描述】:
我的查询
select state,count(*) from crm_lead group by state;
返回
state count
done 794
open 560
pending 3
draft 8
cancel 1
但有时我的表中没有“取消”任务
state count
done 794
open 560
pending 4
draft 8
我想在结果中包含 count = 0,最好的查询是什么?
【问题讨论】:
-
你有另一个包含所有州名的表吗?
标签: sql postgresql postgresql-9.1