如何给出一个以上的条款

时间:2018-06-13 12:59:22

标签: mysql sql

我在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

1 个答案:

答案 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

您可以使用

追加多个条件