Posted on: 9/11/2014 11:18:23 AM | Views : 409

I was able to run the below query fine:
SELECT QTTYP.Qt_Grp,  CFQR.ReferralCode,  CFQR.RecKey,  Count(CFQR.RecKey) AS Cnt FROM [HR_DEV_DM].[CFQ_TEST].CFQ_Referrals as CFQR  INNER JOIN [HR_DEV_DM].[CFQ_TEST].t_Qt_Typs as QTTYP  ON CFQR.QuoteType = QTTYP.Qt_Grp WHERE (((CFQR.QuoteType) Not In ('AUTO/CYCLE','COMMERCIAL','CYCLE'))  AND ((CFQR.QuoteDate)>=DateAdd("m",-15,CONVERT (date, GETDATE()))) AND ((CFQR.RecCntdAsRefrl)=1)) GROUP BY QTTYP.Qt_Grp,  CFQR.ReferralCode,  CFQR.RecKey,  CFQR.RecChangeID HAVING (((Count(CFQR.RecKey))>1) AND ((CFQR.RecChangeID) Is Null))  OR (((Count(CFQR.RecKey))>1)  AND ((CFQR.RecChangeID) Not In (1035))) ORDER BY QTTYP.Qt_Grp, CFQR.RecKey;

I am trying to add the output columns into a temp table. But when I add the "into" statement, as shown below, ...

Go to the complete details ...