Match and create relationship with each node in result

Hi,

I want to do the following

Match n:Node WHERE n.someprop = somevalue
Match m:ANode WHERE ID(m)=21
Create relationship for all n nodes with m

How can I achieve it with a single cypher? Is FOREACH is an effective way to do it? Or someother way is there to do it.

Thanks,
Skanda

Hi,

You can try

Match m:ANode WHERE ID(m)=21
with m
Match n:Node WHERE n.someprop = somevalue
CREATE (m)-[:REL]->(n)

Bennu

Thanks Bennu, Just now myself found the same!