select distinct ba.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
inner join tbl_LST_PartnerListItems pli
on pli.partnerId = ba.partnerId
where ba.ownerId = 14
and ba.ownerType = 'BRO'
and pli.listId = 182900
select opr.crmActive, opr.territoryId from tbl_OPR_ClientOperators opr
where opr.ownerId = 14
and opr.fsltablecode = 'BRO'
and opr.operatorId =
update tbl_OPR_ClientOperators
set crmActive = ,
territoryId =
where ownerId = 2512
and fsltablecode = 'BRO'
and operatorId =