Reputation: 644
I work on neo4j graph , I wrote this query
match (rec:Recipe) , (rec1:Recipe) , (rec)-[r:ContainsIngredient]->() , (rec1)- [r1:ContainsIngredient]->()
where rec.name = "a" AND rec1.name = "b"
return count(r) , count(r1)
it returns the same value , although Recipe("a") have three relations and Recipe("b") have 5 relations . note : I noticed that it always returns the bigger value .
Upvotes: 1
Views: 86
Reputation: 7790
You aren't grouping by the recipe name. Try this:
MATCH (rec:Recipe)
WHERE rec.name = "a" OR rec.name = "b"
MATCH (rec)-[:ContainsIngredient]->()
RETURN rec.name, COUNT(*)
Upvotes: 1