Hi All,T-SQL noob here...Having some trouble grouping by a calculated col. and was wondering if someone could point me in the right direction.My current SQL code is:SELECT (x.[Partner] + ' ' + x.[Product]) AS [Brand], x.[RetentionCalls], x.[RenewalCalls], x.[SR], x.[Retained], ([Retained]+[SR])/([RetentionCalls]+[RenewalCalls])*100.00 AS [C2S], --Need Percentage ROUND(([RenewalCalls])/([RetentionCalls]+[RenewalCalls]),2)*100.00 AS [RCP] --Need PercentageFROM (SELECT PartnerGroups.RetentionMIGroupings AS [Partner], StoreMaster.Product, SUM(CASE WHEN ISNULL(StoreMaster.CallType,0)='Retention Call' THEN 1 ELSE 0 END) AS [RetentionCalls], SUM(CASE WHEN ISNULL(StoreMaster.CallType,0)='Renewal Call' THEN 1 ELSE 0 END) AS [RenewalCalls], SUM(CASE WHEN ISNULL(StoreMaster.[Type],0)='Standard Renewal' THEN 1 ELSE 0 END) AS [SR], SUM(CASE WHEN ISNULL(StoreMaster.Retained,0)='Yes' THEN 1 ELSE 0 END) AS Retained FROM StoreMaster INNER JOIN PartnerGroups ON StoreMaster.[Partner]= PartnerGroups.[Partner] GROUP BY StoreMaster.RACAF, StoreMaster.[Date] , StoreMaster.Product, PartnerGroups.RetentionMIGroupings ) xGROUP BY x.[Partner], x.[Product], x.[RetentionCalls], x.[RenewalCalls], x.[SR], x.[Retained]
I am wanting to Group By my calculated column [Brand], I have tried a few things with no luck.Thanks,