How to delete relation between two nodes?

cypher, neo4j

Solution

You want to use different node identifiers for the two nodes you're matching, or it won't match either:

MATCH (n:Company {companyName:"Amagi Media Labs"})-[r:HAS_CUSTOMER]-(m:Company {companyName:"IBN7"})
DELETE r 
RETURN n,r;

Update: you can't return the relationship, so you'd only be able to `RETURN n, m` after the `DELETE`.

Problem

I am unable to delete relation between two nodes. I am getting this result Returned 0 rows in 252 ms only. my query is: ``` MATCH (n: Company{ companyName : "Amagi Media Labs"})-[r: HAS_CUSTOMER]-(n: Company{ companyName : "IBN7"} ) delete r RETURN n,r; ``` How can I write this query. Help is appreciated.

Original source