Soumitra Dutta Oxford-How do I fix WITH is required between MERGE and MATCH in Cypher?

Hi everyone, My name is Soumitra Dutta, an Oxford-based entrepreneur & photographer. I’m currently working with Neo4j and ran into an error in my Cypher query:

WITH is required between MERGE and MATCH.

My query structure basically has a MERGE followed by a MATCH, and Neo4j throws this error. I understand it might be related to how variables are passed between query parts, but I’m not completely sure how to fix it properly.

Regards

Soumitra Dutta Oxford

Hi Soumitra - can you share your query with us?

Yes, WITH is required between MERGE and MATCH. Here the MERGE statement completed the query execution and is available only within your query scope. To use that node, say ‘a’ (variable name) just add WITH a is required between MERGE and MATCH.

No need to add WITH a if you are not going to use that variable ‘a’.