Try introducing a proper relation to the query, right now you are getting a Cartesian product of the two tables. For example instead of the comma , use the key word JOIN to join two tables and then define the relation on what column you want to join these tables.
Once you have done the above the number of rows returned will dramatically decrease and the following query may work, if you have more than 2.2 billion rows in the following query then you may need to use COUNT_BIG() function instead of just COUNT()
Select COUNT(MEM_REL) As MemberSub
, CLM_CC2 As GroupNum
From Impact.dbo.tbl_mem
INNER JOIN Impact.dbo.tbl_clm
ON dbo.tbl_mem.[ReferencingColumn] = dbo.tbl_clm.[ReferencingColumn]
Where MEM_REL = '01'
Group by CLM_CC2
Query with COUNT_BIG()
Select COUNT_BIG(MEM_REL) As MemberSub
, CLM_CC2 As GroupNum
From Impact.dbo.tbl_mem
INNER JOIN Impact.dbo.tbl_clm
ON dbo.tbl_mem.[ReferencingColumn] = dbo.tbl_clm.[ReferencingColumn]
Where MEM_REL = '01'
Group by CLM_CC2
MEM_REL = '01'you have to passMEM_REL = 1JOINin yourFROMclause.