Skip to content
Advertisement

Where clause on count column

I have two tables pdc and class

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!='' and given=0 
group by roll

I want a condition on count (amount) column

Advertisement

Answer

Use having clause instead

 . . .
having count(amount) = 0;
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement