首页 > 解决方案 > 每次应用 WHERE 子句时,每个省的 COUNT 总是失败

问题描述

所以我需要计算每个省有多少不活跃的客户,但是每次我使用 where 子句设置过滤器时它总是“查询没有结果”。任何人都知道如何摆脱这个问题?

SELECT a.province, count(t.customer_id) as total_customer_on_each_province

FROM total_customer t
LEFT JOIN last_address a on a.customer_id = t.customer_id

WHERE t.status = 'INACTIVE'
GROUP BY province

标签: sql

解决方案


推荐阅读