开发常用sql句式记录
1.按属性统计,并且将不存在的属性统计为0
左连接+count函数。因为count函数不统计null。所以要count(右表属性)
postgre示例:
select count(e.id) as cnt,d.name as type from district d LEFT JOIN examination_application e
ON ST_Intersects(d.position,e.dig_position)
<where>
原创
2022-04-01 11:04:33 ·
314 阅读 ·
0 评论