I have 2 tables, job_stats (the job statuses) and works which are job items

I want to count the number of jobs not completed , however I also want all the statuses, ie even a status with a zero value..

select job_stats.job_stat_id, job_stat_color,
concat_ws(': ', job_stats.job_stat_code, job_stats.job_stat) as job_stat,
count(works.job_stat_id) as c
from job_stats
left  join works on job_stats.job_stat_id = works.job_stat_id
where  works.completed is null
group by works.job_stat_id, job_stat_color, job_stat
order by job_stat_id asc;

Help would be very much appreciated


PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to