and ( cdr.cdr_dstcompanytype in ( 'P', 'B' ) or cdr.cdr_dstcompanytype is null ) and cdr.cdr_territoryid in () and pdst.dstid in () order by cdr.cdr_dstname ---> select distinct top #_maxItems# dst.dstid as cdr_recordid, dst.dstname as cdr_dstname, dst.dstcity as cdr_dstcity, dst.dststate as cdr_dststate from tbl_dst_distributors dst with (nolock) inner join tbl_cdr_distributors cdr with (nolock) on cdr.fsl_dstid = dst.dstid and cdr.ownerid = and cdr.fsl_tablecode = 'mfr' where 1 = 1 and ( ( dst.dstname like or dst.dstcity like or dst.dststate like ) and 1 = 1 ) order by dst.dstname #_data#