2017-10-16 141 views

回答

1

您骨料r計數r時,這意味着每一行都會有一個計數的準確1.

爲了解決這個問題,你應該爲聚合p

match (p:P)<-[r:LINK]-(:G) 
with p, count(r) as num 
where num > 100 
match (p)<-[r:LINK]-(:G) 
delete r 

另一個選項是collect與列表的關係,unwind對於選定的關係:

match (p:P)<-[r:LINK]-(:G) 
with p, count(r) as num, collect(r) as rs 
where num > 100 
unwind rs as r 
delete r 

如果使用這種方法,你不妨忽略count(r)和檢查rs集合的大小:

match (p:P)<-[r:LINK]-(:G) 
with p, collect(r) as rs 
where size(rs) > 100 
unwind rs as r 
delete r 
+0

但如果我這樣做的,變量R沒有定義了 – user732456

+0

你對。要解決這個問題,請使用另一個「匹配」 - 我相應地編輯了我的答案。 –

+0

仍然沒有結果。在「匹配(p:P)< - [r:LINK] - (:G)返回p,count(r)作爲num order by num desc limit(25)」後仍然返回結果「仍然返回計數超過1000的結果 – user732456

相關問題