How to query nodes conditioned on another query?

For example, I have Product nodes and Category nodes. Some nodes are both Product and Category and created separately, not created with multiple labels.


If = 'Smart Phone' and'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'.


I think this simple request should answer your question:)

MATCH (p:Product) WHERE = "Smart Phone" RETURN p


MATCH (p:Product{name:"Smart Phone"}) RETURN p

Actually, I want 2 queries:

Match (n:Product) 
Match (m:Category)
Where =

Which returns what I want. Any potential issue about that?

Did this request work?

MATCH (n:Product) 
MATCH (m:Category)

That works, except for a typo 'p'. It should be 'm' or 'n', right?

1 Like

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:)