Cypher group by subquery语法

时间:2016-07-18 15:49:47

标签: neo4j cypher aggregation

我需要在Neo4j上的Cypher中对聚合进行聚合;

match (
  match (w:words) 
  return distinct k.word as word, count(w) as count, count(distinct w.id) as id
  ) as a
return distinct id, count(word), sum(count);

这可能,谷歌建议不是吗?

1 个答案:

答案 0 :(得分:0)

使用with尝试这样的事情:

match (w:words)
with distinct w.word as word, count(w) as count, count(distinct w.id) as id
return distinct id, count(word), sum(count);