Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-11-2020 11:31 AM
I have Company nodes which are related to User nodes and Users have the plan_type trait. A Company could have multiple Users and Users could have different plan_types from one another.
I need to return a list of Company where none of the Users have a certain plan type.
MATCH (c:Company)-[:CLAIMED_BY]-(u:User)
WHERE NOT u.plan_type in ['Beginner','Intermediate']
RETURN c.name
But this way, if a Company has three Users with the plans Beginner, Intermediate, and Advanced, it will still return the Company because of the Advanced User.
Solved! Go to Solution.
03-11-2020 11:48 AM
There's a few ways to get to this, but here is one that might work:
MATCH (c:Company)-[:CLAIMED_BY]-(u:User)
WITH c, collect(DISTINCT u.plan_type) AS c_plans
WHERE NOT 'Beginner' IN c_plans AND NOT 'Intermediate' IN c_plans
RETURN c.name
03-11-2020 11:48 AM
There's a few ways to get to this, but here is one that might work:
MATCH (c:Company)-[:CLAIMED_BY]-(u:User)
WITH c, collect(DISTINCT u.plan_type) AS c_plans
WHERE NOT 'Beginner' IN c_plans AND NOT 'Intermediate' IN c_plans
RETURN c.name
All the sessions of the conference are now available online