START me = node(1) MATCH me-[:KNOWS*0..1]-friend-[:UPDATES_STATUS]-> statusUpdate RETURN statusUpdate
Assume that my project is Facebook. I want to display a feed which consists of my status updates and my friends' status updates both.
Here are the relations;
- user KNOWS user
- user UPDATES_STATUS status
This is how I get my friends status updates;
START me = node(1) MATCH me-[:KNOWS]-()-[:UPDATES_STATUS]->friendsStatusUpdates RETURN friendsStatusUpdates
And this is how I get my own status updates;
START me = node(1) MATCH me-[:UPDATES_STATUS]->myStatusUpdates RETURN myStatusUpdates
Both queries work fine but I need a single query that combines these two.
Here is the StackOverflow link for the same question.
Thanks in advance.
START me = node(1) MATCH me-[:KNOWS*0..1]-friend-[:UPDATES_STATUS]-> statusUpdate RETURN DISTINCT statusUpdate
START me = node(1)
MATCH me-[:KNOWS*0..1]-friend
WITH distinct friend
MATCH friend-[:UPDATES_STATUS]-> statusUpdate
RETURN DISTINCT statusUpdate