“在此上下文中聚合函数的无效使用”在SET查询(Neo4j) [英] "Invalid use of aggregating function in this context" in a SET query (Neo4j)
本文介绍了“在此上下文中聚合函数的无效使用”在SET查询(Neo4j)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道为什么这被认为是无效的使用聚合函数在Neo4j的Cypher:
MATCH [:EMPLOYS] - (n:Person)SET p.youngest = MIN(n.age);
以下内容被认为是有效的用例:
MATCH(p:Project) - [:EMPLOYS] - (n:Person)RETURN p.name,MIN(n.age)
如何重写第一个查询以使其有效?
<对于为什么你原来的Cypher尝试不工作,@mah的答案工作:Cypher只允许聚合函数用于
WITH
和 RETURN
子句。 I wonder why this is considered an invalid use of aggregate functions in Neo4j's Cypher:
MATCH (p:Project)-[:EMPLOYS]-(n:Person) SET p.youngest = MIN(n.age);
While the following is considered a valid use case:
MATCH (p:Project)-[:EMPLOYS]-(n:Person) RETURN p.name, MIN(n.age) AS youngest;
How should I rewrite the first query to make it valid?
解决方案
As for "why" your original Cypher attempt does not work, and the answer by @mah does work: Cypher only permits aggregation functions to be used in WITH
and RETURN
clauses.
这篇关于“在此上下文中聚合函数的无效使用”在SET查询(Neo4j)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文