with redistributors as ( select cdr.cdr_recordId as dstId, cdr.cdr_dstname, dst.dstcity, dst.dststate, dst.dstzip from tbl_CDR_Distributors cdr with (nolock) left outer join tbl_DST_Distributors dst with (nolock) on cdr.fsl_dstId = dst.dstId where cdr.cdr_dstcompanytype = 'R' and cdr.ownerId = and cdr.fsl_tablecode = ) #forJSON( 'redistributors', attributes.dataStore, 'cdr_dstName' )#