Reputation: 157
I am new to Neo4j. Below is my social graph image which I have created in my Neo4j. Currently I am looking for a Cypher query which will fetch all Friends of "Rohit" who Like "Trekking"
I have tried the following but it is not working.
MATCH (:Profile{name:"Rohit"})-[:Friend]-(p:Profile)
WITH p
MATCH (p)-[l:Like]-(:Hobby{name:"Trekking"})
RETURN l
Upvotes: 1
Views: 86
Reputation: 1613
If you want to return the friend you should return p
instead of l
. Moreover, I think you don't need to use a WITH
here (although you can, if you wish), you can try something like
MATCH (:Profile{name:"Rohit"})-[:Friend]->(p:Profile)-[:Like]->(:Hobby{name:"Trekking"})
RETURN p
This should work
Upvotes: 2