简体   繁体   English

在AQL中组合2个结果集

[英]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? 有没有一种方法可以将2个结果集(通过2个不同的查询获得)组合到一个结果集中? 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. UNION_DISTINCT()做明显的事情。

You could simply RETURN UNION(_,_), but in that case the result would be an array with one item, namely the array of interest: 您可以简单地返回UNION(_,_),但是在那种情况下,结果将是一个包含一项的数组,即感兴趣的数组:

[
  [
    "1",
    "2",
    "3",
    "4"
  ]
]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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