Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-19-2020 03:02 PM
For example, I have Product nodes and Category nodes. Some nodes are both Product and Category and created separately, not created with multiple labels.
Product(A)
Category(B)
If A.name = 'Smart Phone' and B.name='Smart Phone'. How to write a query to return all nodes like 'A'? That is, A is a Product, and B is a category, their 'name' property is the same. Based on the same name, I want to find all Product nodes like 'A'.
Solved! Go to Solution.
05-20-2020 01:28 AM
Did this request work?
MATCH (n:Product)
MATCH (m:Category)
WHERE n.name = m.name
RETURN n
05-19-2020 03:16 PM
Hello,
I think this simple request should answer your question:)
MATCH (p:Product) WHERE p.name = "Smart Phone" RETURN p
OR
MATCH (p:Product{name:"Smart Phone"}) RETURN p
05-19-2020 07:15 PM
Actually, I want 2 queries:
Match (n:Product)
Match (m:Category)
Where n.name = m.name
Which returns what I want. Any potential issue about that?
05-20-2020 01:28 AM
Did this request work?
MATCH (n:Product)
MATCH (m:Category)
WHERE n.name = m.name
RETURN n
05-20-2020 10:36 AM
That works, except for a typo 'p'. It should be 'm' or 'n', right?
05-20-2020 10:51 AM
Yeah, sorry:) I updated the answer:)
If that's all, you can accept the message with the answer as an answer to close this topic:)
All the sessions of the conference are now available online