Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-05-2022 11:37 PM - edited 10-06-2022 01:15 AM
Write a query to find all actors who satisfy the following conditions:
Eleven actors in the graph satisfy the above conditions - 11 records returned in total.
The data set for this query is the default Movie database in Neo4j.
Solved! Go to Solution.
10-06-2022 05:12 AM - edited 10-06-2022 05:13 AM
This is one approach:
match(n:Person{name: 'Tom Hanks'})-[:ACTED_IN]->(m:Movie)<-[:ACTED_IN]-(o:Person)
where m.released <= 1995
and not exists {
match(n)-[:ACTED_IN]->(x:Movie)<-[:ACTED_IN]-(o)
where x.released > 1995
}
return distinct o.name
10-06-2022 05:12 AM - edited 10-06-2022 05:13 AM
This is one approach:
match(n:Person{name: 'Tom Hanks'})-[:ACTED_IN]->(m:Movie)<-[:ACTED_IN]-(o:Person)
where m.released <= 1995
and not exists {
match(n)-[:ACTED_IN]->(x:Movie)<-[:ACTED_IN]-(o)
where x.released > 1995
}
return distinct o.name
10-06-2022 05:28 AM
Thanks, it works!
All the sessions of the conference are now available online