Vishal G
Vishal G

Reputation: 1531

Neo4j, get specific relationships between a set of nodes

I have one set of node node1 and node2

(node1) <- rel1 - (node2)
(node1) <- rel2 - (node2)
(node1) <- rel3 - (node2)
(node1) <- rel4 - (node2)

I can get all type of relations between them by

MATCH (a:node1) -[r] - (b:node2) RETURN DISTINCT a, b

Now I only want rel1 and rel2 between these nodes

How i can achive this?

Upvotes: 1

Views: 202

Answers (1)

Vishal G
Vishal G

Reputation: 1531

Its working like this

MATCH (a:node1) <-[:rel2 | :rel1] - (b:node2) RETURN DISTINCT a, b

Upvotes: 2

Related Questions