如果节点没有关系并返回true,我想删除节点,否则返回false
match (p:Type {id:72})-->(x)
RETURN
CASE count(x)
WHEN 0 THEN DELETE p 'true'
ELSE 'false'
END AS deleted;
我总是得到无效的语法。这在密码中是否可行?
答案 0 :(得分:1)
或者
match (p:Type {id:72})
where not exists ((p)--())
delete p
答案 1 :(得分:0)
要查找没有关系的节点,您需要使用OPTIONAL MATCH
并在WITH
之后检查空值:
match (p:Type {id:72})
optional match (p)-[r]-()
with p, r
where r IS null
delete p