怎么将match子句的聚合返回结果作为子句给set赋值,如下
发布于 3 年前 作者 wan970127 845 次浏览 来自 问答

match (m:Dog)-[r:Rel]-(n) set m.friendCount = count(distinct n.dogId))

3 回复

用with 拼接吧,你找找with拼接的例子,我现在也想不起来

@pangguoming match (m:Pig)-[r:Love]-(n) with m,n set m.friendCount = count(distinct n.name)尝试过with,总是返回Neo.ClientError.Statement.SyntaxError: Invalid use of aggregating function count(…) in this context (line 1, column 57 (offset: 56))这错误

count()放在with前

match (m:Pig)-[r:Love]-(n) with m, count(n.name) as friendCount set m.friendCount=friendCount

回到顶部