4

I want to list all movies that I act in and the sum of actors in each movie, but the query below only returns the sum of actors apart from me and will not return movie which without other actors.

start me=node({0}) 
match me-[:ACTS_IN]->movie<-[:ACTS_IN]-otherActors 
return movie, count(*) as actorSum
Eve Freeman
  • 32,467
  • 4
  • 86
  • 101
gozizibj
  • 285
  • 1
  • 5
  • 23

1 Answers1

5

You need to break it up with WITH. The problem with your query is that you're claiming the me node in the first part of the match, so me can't ever be in otherActors.

start me=node({0}) 
match me-[:ACTS_IN]->movie
with movie   
match movie<-[:ACTS_IN]-actors 
return movie, count(*) as actorSum
Eve Freeman
  • 32,467
  • 4
  • 86
  • 101