select fsl_dstId, cdr_dstname from tbl_CDR_Distributors p with (nolock) where p.cdr_dstCompanyType = 'P' and p.ownerId = and p.fsl_tablecode = and exists ( select * from tbl_CDR_distributors b with (nolock) inner join tbl_DST_Distributors bb with (nolock) on bb.dstId = b.fsl_dstId where bb.dstparentCo = p.fsl_dstId and b.ownerId = p.ownerId and b.fsl_tablecode = p.fsl_tablecode and b.cdr_territoryId in ( ) ) order by cdr_dstname SELECT cdr_dstname as valueName, fsl_dstId as valueId FROM qmd_ParentsDist SELECT valueName, valueId FROM qmd_Temp where valueId in ( ) #applyFilter( attributes.dataStore.filter )#