Guru Question
| From: | pete M | Date: | Tue, 19 Oct 2004 12:12:08 +0000 |
| Subject: | Guru Question | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-36913@lists.php.net to get a copy of this message | ||
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
tia
Pete