简体   繁体   中英

Combining 2 result sets in AQL

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"]
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"
  ]
]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM