Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 How to show

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-31 : 22:37:01
Mike writes "I have made a query to count the production of assignees during workdays. It is working fine, but I want the query to show all assignees, even if the assignee didn't work that particular day.

The query right now is like:

select count (asgnmnt.callid), asgnmnt.assignee
from asgnmnt, calllog
where calllog.closeddate = 'yyyy-mm-dd'
and asgnmnt.callid = calllog.callid
group by asgnmnt.assignee

Can you help me out?"

nr
SQLTeam MVY

12543 Posts

Posted - 2002-03-31 : 23:18:09
select count(asgnmnt.callid), asgnmnt.assignee
from asgnmnt left outer join calllog
on calllog.closeddate = 'yyyy-mm-dd'
and asgnmnt.callid = calllog.callid
group by asgnmnt.assignee

==========================================
Cursors are useful if you don't know sql.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -