select opr.ownerId, opr.fsltablecode, opr.operatorId, cho.cho_id, opr.fsl_choIdDate, opr.companyName, cho.cho_name from tbl_OPR_ClientOperators opr inner join tbl_CHO_Operators cho on cho.cho_id = opr.fsl_choId where cho.cho_type = 'U' and opr.ownerId > 0 and opr.ownerId = and opr.fsltablecode = 'MFR' and exists ( select * from tbl_CRM_Affiliations a with (nolock) where a.partnerId = cho.cho_parentCo and a.partnerType = 'CHO' and a.ownerId = 66 and a.ownerType ='MSC' ) order by opr.ownerId, opr.fsl_choIdDate, opr.operatorId select * from qmd_chainUnits where operatorId= and ownerId = and fsltablecode =
MFR_#ownerId# re-imported #lsnumberformat( _unitCount )#