Neo4j Cypher Query包括起始节点

goz*_*ibj 4 neo4j cypher

我想列出我所参与的所有电影以及每部电影中演员的总和,但下面的查询只返回除了我之外的演员之和,并且不会返回没有其他演员的电影.

start me=node({0}) 
match me-[:ACTS_IN]->movie<-[:ACTS_IN]-otherActors 
return movie, count(*) as actorSum
Run Code Online (Sandbox Code Playgroud)

Eve*_*man 5

你需要打破它WITH.您的查询的问题是您me在第一部分声明了节点match,因此me无法进入otherActors.

start me=node({0}) 
match me-[:ACTS_IN]->movie
with movie   
match movie<-[:ACTS_IN]-actors 
return movie, count(*) as actorSum
Run Code Online (Sandbox Code Playgroud)