Without DDL, sample data and expected results this is just a guess....
select right(convert(varchar, CCD.startDateTime , 106), 8) as startmonth,
sum(case when CCD.contactDisposition=1 then 1 else 0 end) as TotalCalls1,
sum(case when CCD.contactDisposition=2 then 1 else 0 end) as TotalCalls2
from ContactCallDetail CCD,
ContactQueueDetail CQD
where
CCD.sessionID=CQD.sessionID
and CCD.sessionSeqNum=CQD.sessionSeqNum
and CCD.profileID=CQD.profileID
and CCD.nodeID=CQD.nodeID
and CCD.applicationName='FLVS'
and CCD.contactType=1
and contactDisposition in (1,2)
and CCD.startDateTime >='2011-01-01 00:00:00.000'
and CCD.startDateTime <='2011-12-31 00:59:59.000'
group by right(convert(varchar, startDateTime , 106), 8)
order by 1
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537