I need to query the number of OPEN issues for a given employee. I want to return their last name and the number of issues WHERE issue_status is not "6" (6 is a closed issue)
The issues and the employees are in separate db's. They are linked by employee number. In the employee table the field is employee_id. In the issue table the field is issue_assigned_to.
Are ya wit me so far?
I want this thing to return a "0" if there are no issues that meet the criteria. Instead, it's just not returning a record. Here's the query:
Can anyone help me out on this? Kevin
slanek@ssd.fsi.com
The issues and the employees are in separate db's. They are linked by employee number. In the employee table the field is employee_id. In the issue table the field is issue_assigned_to.
Are ya wit me so far?
I want this thing to return a "0" if there are no issues that meet the criteria. Instead, it's just not returning a record. Here's the query:
Code:
SELECT e.last_name, COUNT(i.issue_id) AS issues
FROM .issues_current.dbo.issue i
LEFT OUTER JOIN employee e
ON i.issue_assigned_to = e.employee_id
WHERE issue_assigned_to = '7682'
AND i.issue_status <> 6
GROUP BY e.last_name
slanek@ssd.fsi.com