with data as ( select distinct choId as agreementOwnerChoId, operatorName as agreementOwnerName from tbl_DW_1fsOperators#_tableSuffix# with (nolock) where ownerId = and ownerType = and purchasing = 'Y' and beneficiary = 'Y' select distinct agreementOwnerChoId, agreementOwnerName from tbl_DW_OperatorAnalyzer#_tableSuffix# with (nolock) where agreementOwnerChoId is not null ) #forJSON( 'data', attributes.datastore, 'agreementOwnerName' )#