I have the following select statement which works fine
SELECT status_id, COUNT(status_id) As total
FROM tbl_project INNER JOIN lkp_status
ON tbl_project.status_id = lkp_status.record_id
GROUP BY status_id
I would like to include the status_name field in the result table but this is not allowed:
SELECT **status_name**, status_id, COUNT(status_id) As total
FROM tbl_project INNER JOIN lkp_status
ON tbl_project.status_id = lkp_status.record_id
GROUP BY status_id
“because it is not contained in either an aggregate function or the GROUP BY clause”
But I just want to have a third column indicating the name of the status_id for each count, which may not be unique :S
Thanks for any suggestions
1 Answer