Nope! with OperatorList as ( select opr.ownerid, opr.fslTableCode, opr.operatorid, opr.companyName, opr.oprCompanyType, opr.oprType, count(m.fspro_userId) numContacts, opr.territoryid, datecreated, opr.classificationid, a.affiliationId, t.name as territoryName from tbl_OPR_ClientOperators opr with (nolock) left outer join tbl_FSPro_Members m with (nolock) on m.fsl_TableCode = opr.fslTableCode and m.ownerid = opr.ownerId and m.orgType = 'OPR' and m.orgId = opr.operatorid left outer join tbl_CRM_Affiliations a with (nolock) on a.ownerType = opr.fslTableCode and a.ownerid = opr.ownerid and a.orgType = 'OPR' and a.orgId = 3402581 and a.partnerid = opr.operatorid and a.partnerType = 'OPR' left outer join tbl_TER_Territories t on t.territoryid = opr.territoryId where opr.ownerid = 1120 and opr.fslTableCode = 'MFR' group by opr.ownerid, opr.fslTableCode, opr.operatorid, opr.companyName, opr.oprType, datecreated, opr.oprCompanyType, opr.territoryid, opr.classificationid, a.affiliationId, t.name ) select ownerid, fslTableCode, operatorid, companyName, oprCompanyType, oprType, numContacts, territoryid, datecreated, classificationid, affiliationId, territoryName from OperatorList where ( (OperatorList.oprType = 'D') or ( OperatorList.oprType = 'C' and (numContacts = 0 and affiliationid is null) ) ) --and OperatorList.datecreated < '01/01/2020' and OperatorList.oprCompanyType = '0' and OperatorList.classificationid NOT IN (1087760,1087761) and OperatorList.territoryid <> 9261 order by OperatorList.companyName DELETE FROM tbl_OPR_ClientOperators WHERE OwnerID = AND FSLTableCode = AND OperatorID = delete from tbl_CRM_Affiliations where ownerId = and ownerType = and partnerType = 'OPR' and partnerId = DELETE FROM tbl_FSPro_Members WHERE OwnerID = AND FSL_TableCode = AND orgID = AND orgType = 'OPR' AND staffmember = 0 DELETE FROM tbl_OPR_CustAttrbLnks WHERE Opr_ID =