I have what should have been a relatively easy Count() query that I just can't get to return the correct information.
Here's what I have:
The issue is, a field ci_issue_status.FK_CI_ISSUE_ID (the issue ID from another table) has multiple entries...and I need it to return only the current (LAST) entry for each ID.
If I add FK_CI_ISSUE_ID into the query, I get a count of 1 for each entry, so how do I get it to pull the last entry for each ID, and then count the number for each status?
Any help would be GREATLY appreciated!
Here's what I have:
Code:
SELECT ci_lookup_status.CL_STATUS, Count(ci_lookup_status.CL_STATUS) AS CountOfCL_STATUS
FROM ci_issue_status INNER JOIN ci_lookup_status ON ci_issue_status.FK_CLK_STATUS = ci_lookup_status.PK_CL_ID
GROUP BY ci_lookup_status.CL_STATUS
HAVING (((ci_lookup_status.CL_STATUS)<>'Legacy Comments' And (ci_lookup_status.CL_STATUS)<>'Unfunded' And (ci_lookup_status.CL_STATUS)<>'Cancelled'));
The issue is, a field ci_issue_status.FK_CI_ISSUE_ID (the issue ID from another table) has multiple entries...and I need it to return only the current (LAST) entry for each ID.
If I add FK_CI_ISSUE_ID into the query, I get a count of 1 for each entry, so how do I get it to pull the last entry for each ID, and then count the number for each status?
Any help would be GREATLY appreciated!