Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-24-2020 03:16 PM
Hello,
here is my code:
match (c:People)-[:LIKES]->(a:Object{objectName:'Skittles'})
WITH collect(c) as set1
match (d:People)-[: LIKES]->(a: Object{objectName:'Cheerios'})
WITH collect(d) as set2
RETURN apoc.coll.intersection(set1, set2) as set3
when I run this, it returns set1 is not found. But if I replace the last line with
RETURN apoc.coll.intersection(set2, set2) as set3
it works.
so, it seems that the first with is not passing set1 through.
Could anyone enlighten me with this issue?
ps:
my goal is to return people who both like Cheerios and Skittles. Any other way could get around with this issue could be fine.
Thanks in advance
09-24-2020 04:48 PM
Include set1 in your 2nd WITH statement. So,
WITH set1, collect(d) as set2
Each WITH clause is passing only the variables defined in it.
09-24-2020 04:54 PM
That is very helpful. Thank you. Appreciated.
All the sessions of the conference are now available online