Simple way to delete a relationship by ID in Neo4j Cypher?
Asked Answered
S

3

18

Using Match and Where can delete a relationship by ID.

Match ()-[r]-() Where ID(r)=1 Delete r

Is there a simpler way?

Stopcock answered 28/1, 2015 at 5:57 Comment(1)
What's wrong with what you have?Zenas
L
8

Using the old syntax, but that will be removed in a future version.

start r=rel(id) delete r;
Lying answered 28/1, 2015 at 6:57 Comment(0)
T
29

I use

MATCH ()-[r]-() WHERE id(r)=49 DELETE r
Ti answered 3/4, 2017 at 14:37 Comment(0)
L
8

Using the old syntax, but that will be removed in a future version.

start r=rel(id) delete r;
Lying answered 28/1, 2015 at 6:57 Comment(0)
S
8

You can delete by simple modified chyper for delete some Relations.

This is my code:

MATCH ()-[r]->() WHERE id(r)=43 OR id(r)=44 OR id(r)=45 DELETE r
Subservient answered 4/8, 2018 at 15:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.