Reputation: 147
An entry level question. I am trying out Desktop Neo4j v4.3.1. So far I have created to nodes with
CREATE (n:CST {cst_id:'CST_ID_1'}) RETURN n
CREATE (n:CST {csT_id:'CST_ID_2'}) RETURN n
CREATE (n:CST {csT_id:'CST_ID_3'}) RETURN n
Supposedly representing two customers. . What I would like to do is to
So far, I have tried
MATCH (c:CST),(d:CST)
WHERE c.cst_id='CST_ID_1' AND d.cst_id='CST_ID_2'
RETURN c,d
which returns nothing. Changing the AND to OR results in returning all three nodes.
Upvotes: 0
Views: 613
Reputation: 3815
Firstly I would like to point out that your cst_id
is different. The first node has cst_id
and the second and third have csT_id
(notice the capital T
). I'm unsure if that's intentional however, I will be constant in my example:
MATCH (a:CST {cst_id: "CST_ID_1"})
MATCH (b:CST {cst_id: "CST_ID_2"})
CREATE (a)-[:MY_EDGE_NAME]->(b)
Above I perform two matches and then create an edge between the two matched nodes called MY_EDGE_NAME
. If CST_ID_1
or CST_ID_2
don't match the relationship will not be created.
Upvotes: 1