如何在下面的语句中执行DELETE子句?
MATCH (u:User {userId:'ce5e59de-af34-4dba-a134-8ff1de3696b6'})-[r:WRITE*..2]-(p)
RETURN u,r,p
UNION MATCH (u:User {userId:'ce5e59de-af34-4dba-a134-8ff1de3696b6'})-[r:COMMENT]-(p)
RETURN u,r,p
答案 0 :(得分:2)
您无法在已撰写的查询中添加DELETE
,但您可以不同方式编写,以便独立删除每个步骤:
MATCH (u:User {userId:'ce5e59de-af34-4dba-a134-8ff1de3696b6'})
OPTIONAL MATCH (u)-[:WRITE*..2]-(p)
DETACH DELETE p
WITH DISTINCT u
OPTIONAL MATCH (u)-[:COMMENT]-(p)
DETACH DELETE u, p