我想列出我演过的所有电影以及每部电影中 Actor 的总和,但下面的查询仅返回除我之外的 Actor 总和,不会返回没有其他 Actor 的电影。
start me=node({0})
match me-[:ACTS_IN]->movie<-[:ACTS_IN]-otherActors
return movie, count(*) as actorSum
最佳答案
您需要使用WITH
将其分解。您的查询的问题在于您在 match
的第一部分声明了 me
节点,因此 me
永远不可能在otherActors
中。
start me=node({0})
match me-[:ACTS_IN]->movie
with movie
match movie<-[:ACTS_IN]-actors
return movie, count(*) as actorSum
关于Neo4j Cypher 查询包括起始节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18691667/