Thank you all for your suggestions.I tried the ways u all mentioned but doesn't seem it work
I am pasting my actual query here :
select b.Name,b.Customer,a.contact,count(b.phonecall)
from contacttype a
left outer join (select contacttypeid,Name,Customer,phonecall from phonecall where calldate = '2004-08-24 10:29:42.000') as b
on a.contacttypeid=b.contacttypeid
group by b.name,b.Customer,a.contact
Contacttype is a lookup table with 4 types of contact like "Incoming phone call" "outgoing phonecall".....
The counts for all the phonecalls should be displayed no matter there is a corresponding entry in the phonecall table.The above query satisfies that requirement.
The suggested query by dmcmunn is like given below(Correct me if i am wrong):
select b.Name,b.Customer,a.contact,count(b.phonecall)
from contacttype a
left outer join phonecall b
on a.contacttypeid=b.contacttypeid
where b.calldate='2004-08-24 10:29:42.000'
group by b.name,b.Customer,a.contact
The problem here is the WHERE clause makes Left outer join useless.So i get only those records which are present in phonecall table and not all the combinations present in the contacttype table.
"P.S. How's the DOD doing anyway ?" -> not sure what it means!
