Showing employees with null values

  • Thread starter Thread starter Dos Equis
  • Start date Start date
D

Dos Equis

I have 10 employees. Of those 10, I have an action taken by 3 of them
which must be documented and counted for number of occurences per
week. How do I make a report which documents ALL employees and
indicates a number of occurences for only those employees the action
applies to? I am looking for results which resemble this:


Jim Brown 2
James Mercer 0
Harry Genes 0
Ema Tard 8
Jimmie Barre 1
Adam Aims 0


All numbers indicate an action which has been counted, all 0's
indicate these employees have not taken this action.

Any help would be greatly appreciated and I can explain further if
required.

Thanks,

Byron
 
Hi Byron,

To achieve this, you need to use a left join not an inner join, like this:

select EmployeeName, count(ItemID) from
tblEmployee left join tblItem on tblEmployee.EmployeeID = tblItem.EmployeeID
group by EmployeeName

Hope this helps.

Damian.
 
Hi Byron,

To achieve this, you need to use a left join not an inner join, like this:

select EmployeeName, count(ItemID) from
tblEmployee left join tblItem on tblEmployee.EmployeeID = tblItem.EmployeeID
group by EmployeeName

Hope this helps.

Damian.








- Show quoted text -

Aside from I should have worked that out, I've been working on it for
weeks. Thank You! Worked perfectly.

Byron
 
Back
Top