gpt4 book ai didi

mysql - 我的 sql 对计数值求和

转载 作者:行者123 更新时间:2023-11-29 14:52:41 25 4
gpt4 key购买 nike

Select Count(Case When an_user_plan.campaign_pid != 0 Then 1 End) As Email,
Count(Case When an_user_plan.sms_pid != 0 Then 1 End) As Sms,
Count(Case When an_user_plan.survey_pid != 0 Then 1 End) As Survey,
sum(Email,Sms,Survey)as total
From an_user_plan

sum(Email,Sms,Survey)as Total 在如何对三个值求和方面存在错误我想要总计为三个计数值的加法怎么办请帮帮我

最佳答案

SELECT SUM(campaign_pid != 0 +
sms_pid != 0 +
survey_pid != 0) AS total, ...

关于mysql - 我的 sql 对计数值求和,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5416139/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com