I am learning the Cypher querying language using the sample movie database provided by neo4j and I had a question about syntax if I want to use multiple variables in an OR query.
If I wanted to run a query similar to that below, to assign the variable m to movie nodes and p to person nodes, how should I write the following query? I tried a number of different variations with &, {}, and multiple () but nothing is correct, and the document is silent on how (or even whether it is possible) to write such a query.
<MATCH (m:Movie|p:Person)
RETURN p.name AS name,m.title AS title/>
Thank you for the reply. I was just interested if different variables could be assigned to different nodes in an OR, or AND match. I do not have a particular use case.
When you are using an OR or AND with labels in a match statement, you are still searching for a single entity. That is why you bind the results to one variable.
The results of each match statement can be bound to different variables.