Reputation: 907
I have set of nodes with property "x". I want to create node with property "y" and make relationships to "x" nodes in one query. I made this query:
MATCH (x) WHERE has(x.x) CREATE (y{y:"y"}), (y)-[:REL]->(x);
This makes two nodes "y" and each of them have one relationship to "x", but I want one node "y" and from this node two relationships to every "x" node.
Upvotes: 1
Views: 922
Reputation: 907
Solved
MATCH (x) WHERE HAS (x.x) MERGE (y { y:"y" }) CREATE (y)-[:REL]->(x);
Upvotes: 2