[英]Neo4j cypher ALL IN
I have the following Cypher query: 我有以下Cypher查询:
MATCH (genre:Genre)<-[:BELONGS_TO]-(t:Title)
WHERE genre.name IN ["Comedy", "Drama"]
RETURN t
Which returns titles that belong to Comedy OR
Drama genres. 返回属于喜剧
OR
戏剧类型的标题。 How to change this query in order to return all titles that belong to Comedy AND
Drama genres? 如何更改此查询以返回属于喜剧
AND
戏剧类型的所有标题?
SIZE
is your friend. SIZE
是您的朋友。
MATCH (t:Title)-[:BELONGS_TO]->(g:Gender)
WHERE g.name IN ["Comedy", "Drama"]
WITH t, COLLECT(g) AS g
WHERE SIZE(g) >= x
RETURN t
x
- is number of elements in IN clause x
是IN子句中的元素数
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.