Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-10-2022 12:37 AM
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
.
03-10-2022 02:49 AM
Groupby is done implicitly by all of the aggregate functions.
This statement is semantically equivalent to groupby for m.title
.
Note that all columns not contained within the aggregate function will be the groupby keys.
03-10-2022 06:20 PM
Thanks.
In that case, how groupby is performed when we have more than 2 columns?
return p2.name, p2.born, sum(r.earnings)/count(p2)
10-10-2022 08:43 PM
This statement will group by p2.name and p2.born and compute the quotient of the aggregate function sum and count.
All the sessions of the conference are now available online