select p.participantId, p.ownerId, p.ownerType, p.partnerid, p.partnerType, p.collateralURL, p.extRefNum, m.marketingActivityName from tbl_CRM_Participants p inner join tbl_CRM_MarketingActivities m on m.marketingActivityId = p.marketingActivityId where p.ownerId = and p.ownerType = and p.marketingActivityId = and exists ( select * from tbl_OPR_ClientOperators opr where opr.operatorId = p.partnerId and p.partnerType = 'OPR' and opr.crmActive = 'Y' and opr.ownerId = p.ownerId and opr.fsltablecode = p.ownerType ) select companyName, operatorId,state from tbl_OPR_ClientOperators where operatorId = and crmActive = 'Y' and ownerId = and fsltablecode = select fileId, contentId from tbl_OPR_Repository where ownerId = and ownerType = and docTitle = and containerId = and containerType = 'OPR' and fileExt = 'PDF' select fileId, contentId from tbl_OPR_Repository where ownerId = and ownerType = and docTitle = and containerId = and containerType = 'OPR' and fileExt = 'PDF' update tbl_CRM_Participants set collateralURL = where participantId = and ownerId = and ownerType =