如何在密码中合并两个集合

时间:2018-09-26 03:10:49

标签: neo4j cypher

MATCH (self:Person {id:"13619240353"})-[r1]-(N1)-[r2]-(N2) 
where self<>N2  return collect(N1),collect(N2),
self,collect(r2),collect(distinct r1)

我想将collect(N1)和collect(N2)合并为一个集合,然后返回,该怎么做

1 个答案:

答案 0 :(得分:0)

您可以使用+运算符轻松组合2个列表,如下所示:

MATCH (self:Person {id:"13619240353"})-[r1]-(N1)-[r2]-(N2) 
WHERE self <> N2
RETURN
  collect(N1) + collect(N2),
  self, collect(r2), collect(distinct r1)