我在statuss列中有不同的值,如收到,退回,清除,我想获得每个statuss的总行数
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
答案 0 :(得分:0)
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
您可以使用和
追加多个条件