如何在neo4j中搜索多个节点

时间:2021-07-28 17:59:53

I am trying to match multiple nodes but i cant create the correct query.

我试图匹配多个节点,但我无法创建正确的查询。

This query works for david, but how can i add another name after david? such as john?

此查询适用于david,但如何在david之后添加其他名称?比如约翰?

Match (p:People {peopleName:"david"})-[:PEOPLE_ASSOCIATED_PLACE]-(pl:Place)-[:PLACE_ASSOCIATED_EVENT]-(e:Event)  
return p.peopleName, pl.placeName, e.eventTitle, e.eventDate order by e.eventDate desc

1 个解决方案

#1


I think you just need to use the WHERE clause much like SQL

我认为你只需要像SQL一样使用WHERE子句

MATCH (p:People)-[:PEOPLE_ASSOCIATED_PLACE]-(pl:Place)-[:PLACE_ASSOCIATED_EVENT]-(e:Event) 
WHERE p.peopleName in ["david", "John"]
RETURN p.peopleName, pl.placeName, e.eventTitle, e.eventDate order by e.eventDate desc

#1


I think you just need to use the WHERE clause much like SQL

我认为你只需要像SQL一样使用WHERE子句

MATCH (p:People)-[:PEOPLE_ASSOCIATED_PLACE]-(pl:Place)-[:PLACE_ASSOCIATED_EVENT]-(e:Event) 
WHERE p.peopleName in ["david", "John"]
RETURN p.peopleName, pl.placeName, e.eventTitle, e.eventDate order by e.eventDate desc