if you want contact count then you probably want to remove contact_id from the group by clause. And because you seem to need to include your products table then you likely need to count distinct contact_id. Maybe this:select a.region__c as [Region], a.SFTX_ID as [SFTRX ID], count(distinct c.Contact_ID) as [Contact Count]from vwContact cjoin vwaccount a (nolock) on c.accountid = a.idinner JOIN vwInstalled_Product_Line__c IP (Nolock) on a.id = ip.Account__cinner join dbo.RecordType rt (nolock) on a.RecordtypeID = rt.IDwhere ip.Active_Flag__c in ('true')and a.Maintenance_Status__c in ('active')and Product_Line__c in ('Product')and rt.name in ('Customer')and c.active__c in ('true')group by a.region__c,a.SFTRX_IDorder by 2
Be One with the OptimizerTG