I have written the below query to retrieve movie
and corresponding rating
:
match (rvwr:Person)-[r:REVIEWED]->(m:Movie)
where m.released > 2003
return m.title, sum(r.rating)/count(r) as rating
I want to confirm if there is a need to use anything similar to groupby clause
.
No such 'group by' clause in neo4j cypher. Sum is an aggregate function and m.title is not. So cypher will use title as a group by key. Below is the documentation about it.
https://neo4j.com/docs/cypher-manual/current/functions/aggregating/