SQL - Group By with Left Join

Viewed 126818

I have two tables. Table A has a list of employee names. Table B is a complex table with information about phone calls made by employees.

My goal is to make a table with columns 'name' and 'callCount'. I am aiming to do this with a 'left join' and a 'group by', but I keep missing the employees that have made no calls. How can I just get it to keep the name and just put a zero there?

Perhaps I am close and someone can point out my typo? Thanks in advance for your help, here is the SQL:

SELECT A.name, COUNT(B.call_id) AS 'outgoing call count' 
FROM EmployeeTable A 
LEFT JOIN CallTable B 
ON A.name = B.call_from_name
WHERE B.call_type LIKE 'outgoing' 
AND B.voice_mail = '0' 
...
GROUP BY A.name 
2 Answers
Related