SELECT distinct m.LastName + ', ' + m.FirstName LastFirstName, m.LastName, m.FirstName, m.fspro_userid as userId FROM tbl_SEC_attributes a WITH (NOLOCK) INNER JOIN tbl_SEC_AttrbGrpLink agl WITH (NOLOCK) ON agl.attrbId = a.attrbId INNER JOIN tbl_SEC_MemGrpLink mgl WITH (NOLOCK) ON mgl.groupId = agl.groupId INNER JOIN tbl_Fspro_members m WITH (NOLOCK) ON m.fspro_userid = mgl.fspro_userId and m.ownerId = a.ownerId and m.fsl_tablecode = a.fsl_tablecode WHERE a.attrbTypeId = ( SELECT attrbTypeId FROM tbl_SEC_AttributeTypes WHERE attrbTypeCode = 'CRMReportCenter' ) AND a.ownerId = AND a.fsl_tablecode = ORDER BY LastName, FirstName for json path