select distinct partnerId from tbl_BID_Agencies ba
inner join tbl_BID_Bids b
on b.ownerId = ba.ownerId
and b.ownerType = ba.ownerType
and b.bidAgencyId = ba.bidAgencyId
where ba.ownerId = 14 and ba.ownerType = 'BRO'
and ba.partnerId in (
select partnerId from tbl_LST_PartnerListItems
where listId = 167568
)
update tbl_OPR_ClientOperators
set crmActive = 'N', territoryId = null
where ownerId = 2512
and operatorId =