cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Exercise 3.2 page 7 - How to Exclude Lana and Lilly Wachowski

How do I change this cypher to not return Lana and Lily Wachowski?

MATCH (p:Person)-[:WROTE]->(m:Movie)
WHERE NOT m.title = 'Speed Racer'
RETURN p.name;

They still shows up because they wrote another movies
This is exercise 3.2 page 7

1 REPLY 1

Since this one is for a learning exercise, I'll give a hint.

Your current MATCH returns paths for persons who wrote movies. So if a person wrote 5 movies, they will have 5 matching paths, one per movie.
Your WHERE excludes all those where that movie is Speed Racer (but keeps all others, and as you note since they wrote other movies, those paths are not excluded).

First, consider if there are alternate ways to query for a "person...where they wrote a movie", where you get only one row per person, instead one row per "person who writes this movie".

Once you've solved that, consider how to exclude "persons who wrote Speed Racer" without changing or using MATCH to do so.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online