大家好我是cypher查询的新手,我想限制结果中的重复值
查询是
match (ee:Personal {id:"id"})-[:Friend]->(fr),
(fr)-[:Friend]->(fr2),
(fr2)-[:Friend]->(friend:Personal),
(friend)-[:Works]->(comp:Company)
where comp.name=~".*name.*"
and not friend.id="id"
and not (friend)-[:Friend]-(fr)
and not (friend)-[:Friend]-(ee)
and not (fr2)-[:Friend]-(ee)
optional match (comp)-[:Position]->(pos),
(friend)-[:Position]->(pos)
optional match (friend)-[:Location]->(loc)
return distinct friend.name, comp.name
Run Code Online (Sandbox Code Playgroud)
但我得到重复的值,因为返回statemnt中有多个节点属性.如果我只返回一个属性,那么罚款.但我想要不同的朋友
Mic*_*ger 20
如果您想要为每个公司返回不同的朋友,那么整个行的区别是:
return comp.name, collect(distinct friend.name)
Run Code Online (Sandbox Code Playgroud)