gpt4 book ai didi

mysql - 如何给出多于一个的having子句

转载 作者:行者123 更新时间:2023-11-29 17:28:23 25 4
gpt4 key购买 nike

我在状态列中有不同的值,例如已接收、已退回、已清除,并且我想获取每个状态的总行数

select roll_no as roll,sum(pdc.amount) as amount,count(amount) as given,
stu_profile.name,f_name,scholarship,class_id,batch_id,statuss
from stu_profile
left join pdc on pdc.roll = stu_profile.roll_no
where 1 and class_id != ''
group by roll

最佳答案

select roll_no as roll,sum(pdc.amount) as amount,count(amount) as given,
stu_profile.name,f_name,scholarship,class_id,batch_id,statuss
from stu_profile
left join pdc on pdc.roll = stu_profile.roll_no
where 1 and class_id != ''
group by roll
having amount > 0
and count(amount) = 4

您可以使用附加多个具有条件

关于mysql - 如何给出多于一个的having子句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50837924/

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