nosql - Cypher Neo4j ORDER BY DESC query -
nosql - Cypher Neo4j ORDER BY DESC query -
i want order count(movie.title) in descending order. gives error. query.
match (movie {genre:"action"})<-[:acts_in]-(person) "return person.name, movie.genre, count(movie.title)" "order count(movie.title) desc" "limit 100";
thanks!
the error returned because cannot order aggregate in cypher. order aggregate need utilize with operator.
so query should (assumes want list titles per actor per genre):
match (movie {genre:"action"})<-[:acts_in]-(person) homecoming person.name, movie.genre, count(movie.title) person.name name, movie.genre genre, collect(movie.title) titles homecoming name, genre, titles order length(titles) desc limit 100
the limit 100 has changed behaviour want move query:
match (movie {genre:"action"})<-[:acts_in]-(person) homecoming person.name, movie.genre, count(movie.title) person, film limit 100 person.name name, movie.genre genre, collect(movie.title) titles homecoming name, genre, titles order length(titles) desc
aside: create queries perform should have index on movie.genre property , should introduce labels film , person.
neo4j nosql cypher
Comments
Post a Comment