select distinct top 150 c.cho_id, c.cho_name name, c.cho_address street, c.cho_city city, c.cho_state state, c.cho_phone phone, nullif( c.cho_url, '' ) website, case when cho_segmentId = 2 then 'k12' else 'restaurants' end as tastewiseEndPoint, cast( null as varchar ) as tastewiseId, cast( 0 as float ) as tastewiseConfidenceScore, cast( null as varchar ) as twc_id, cast( null as varchar ) as twd_id, o.operatorId clientOperatorId, cast( null as int ) as tastewiseOperatorId, cast( null as int ) as tastewiseChoId, cast( null as varchar ) as tastewiseMatchStatus, cast( null as varchar ) as tastewiseResponse from tbl_DW_CRMOperators#_tableSuffix# o with (nolock) inner join tbl_CHO_Operators c with (nolock) on c.cho_id = o.oneFSID and nullif( c.tastewiseId, '' ) is null and c.cho_type in ( 'I', 'U' ) and c.cho_name not like '%(CLOSED)%' and ( c.cho_segmentId in ( select segmentId from tbl_OPR_Segments with (nolock) where segment like 'Commercial/Rest%' ) --or -- ( c.cho_segmentId = 2 ) ) where oneFSId is not null select operatorId, fsl_choId from tbl_OPR_CLientOperators with (nolock) where ownerId = #_tastewiseOwnerId# and fsltablecode = '#_tastewiseOwnerType#' and mfrCustNum = select * from qmd_choOperators where tastewiseConfidenceScore = 1 and tastewiseOperatorId > 0