I have a complex query where I am trying to count the number of qualified and non qualified in a table called a. If you look at my code you can see that I am only counting the number of qualified=1. What I really need is the number of qualified=1 and the number of qualified=0, for each employee. When I run the code below I am getting an employee's email and the COUNT is 2. But I need the count of the a table, not the count of the srat table. I am not sure how to accomplish this. I'd like to use COUNT(a.qualified=1), COUNT(a.qualified=0) and GROUP BY srat.employee. Any suggestions?
$sql="select srat.employee_email, COUNT (a.*)
from survey_results_activities_temp srat, survey_results sr, relation r, standard_activities sa, activity a where sr.user_email=srat.employee_email AND sr.item_type='AC' AND sr.campaign= '$_SESSION[campaign]' AND sr.email='$_SESSION[userid]' AND sr.item=sa.activity AND sa.standard_id=r.activity_id AND r.id=a.id AND a.qualified=1";