How to combine two arrays into single array in select query (N1QL)

SELECT (ARRAY_FLATTEN ((ARRAY v FOR v IN d.docQuestionsAssociation WHEN v.questionId != ‘1’ END),2)
UNION
ARRAY_FLATTEN((ARRAY v FOR v IN d.docQuestionsAssociation WHEN v.questionId = ‘1’ and v.questionShortName not in [‘question1’] END),2))
FROM document AS d
WHERE fm.type=‘doc’

@RamadossE

SELECT 

ARRAY v FOR v IN d.docQuestionsAssociation 
WHEN v.questionId != "1" OR v.questionShortName NOT IN ["question1"]  
END AS newQuestions

FROM document AS d
WHERE fm.type="doc"

ARRAY_DISTINCT(ARRAY_CONCAT(arr1, arr2))

ARRAY_UNION()
https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/arrayfun.html

@vsr1 , Thank you so much, it’s working as expected. :slightly_smiling_face: