Reputation: 1421
Is there a way to combine 2 results sets (got via 2 different queries) into a single results set? Something like the following?
let results1 = (query1) // ["1","2"]
let results2 = (query2) // ["3","4"]
for r in MERGE_RESULTS(results1,results2) return r // ["1","2","3","4"]
Upvotes: 2
Views: 819
Reputation: 116780
LET results1 = ["1","2"]
LET results2 = ["3","4"]
FOR x IN UNION(results1, results2)
RETURN x
yields an array with the four elements.
UNION_DISTINCT() does the obvious thing.
You could simply RETURN UNION(_,_), but in that case the result would be an array with one item, namely the array of interest:
[
[
"1",
"2",
"3",
"4"
]
]
Upvotes: 4