Cypher group by 子查询语法

Cypher group by subquery syntax

我需要在 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);

这可能吗,google建议不行?

使用 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);