方法:使用 sum合计 派生表 group by 统计了count的条数
例:
select
count(*) as total
from (select count(distinct di.id)
from distribute di
left join auto_creative auto on di.creative_id = auto.creative_id
group by di.promoter_code,di.channel_id,di.customer_source_id,di.assigned_dept,di.ad_account_id,di.third_plan_id,di.third_creative_id) as test
注意:派生表必须加别名,不然数据库回报错.
sql实现 统计 group by (可多个类型) 分组查询总条数
最新推荐文章于 2024-03-28 16:24:22 发布