select int.partnerid, int.partnertype, int.contactid, int.dispositionuserid, int.cdrDistributorId, opr.distrib1 as primaryDistributorId, opr.territoryid
from tbl_crm_interactions int with (nolock)
inner join tbl_opr_clientoperators opr with (nolock)
on opr.operatorid = int.partnerid
and opr.ownerid = int.ownerid
and opr.fsltablecode = int.ownertype
where int.interactionid =
and int.ownerid =
and int.ownertype =
select cdr_dstname, cdr_recordid
from tbl_cdr_distributors
where ownerid =
and fsl_tablecode =
and cdr_recordid =
Distributor: