select cdr.ownerId, cdr.fsl_tablecode, cdr.fsl_dstId, count(*) from tbl_CDR_Distributors cdr with (nolock) inner join tbl_DST_Distributors dst with (nolock) on dst.dstId = cdr.fsl_dstId where cdr.ownerId > 0 and cdr.fsl_mapPriority = 1 group by cdr.ownerId, cdr.fsl_tablecode, cdr.fsl_dstId having count(*) > 1