neo4j - Invalid use of aggregating function max -


match(n)-[r:likes]->(m) count(n) cnt, m cnt = max(cnt) return m 

above query results in following error:

invalid use of aggregating function max(...) in context (line 1, column 61 (offset: 60))

this query should return collection of m nodes have maximum count. needs perform single match operation, , should relatively performant.

match (n)-[:likes]->(m) m, count(n) cnt collect({m: m, cnt: cnt}) data, max(cnt) maxcnt return reduce(ms = [], d in data | case when d.cnt = maxcnt ms + d.m else ms end) ms; 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -