+1 vote
in Databases by (56.8k points)
I want to use two relationship types in a Cypher query, but not sure how to do it. Is it even possible to use multiple relationship types in MATCH statement of Neo4j?

1 Answer

+3 votes
by (40.5k points)
selected by
 
Best answer

If you want to use multiple relationship types in MATCH, you can use the pipe symbol (|).

Here is an example:

MATCH g=(p:Peron)<-[:produced_by|directed_by]-(m:Movie)

RETURN g

In the above example, I am using two relationship types, produced_by and directed_by, to select data from the graph. The above example is not based on real data. You can change node labels and relationship types to run it on real data. 

Related questions

+1 vote
1 answer
asked Jul 13, 2023 in Databases by phpuser (56.8k points)
+3 votes
1 answer
+3 votes
1 answer

...