2

我有以下问题:我想退回评论家评论过的所有独特的瓶子,如果他们评论过的任何瓶子目前在选定的商店出售。问题是我在两个集合中都得到了重复项,虽然我可以单独过滤它们,但我无法过滤连接的结果:

START shop=node:shops('SHOP_ID:...') 
MATCH (shop)-[:SELLS]->(bottle)<-[:REVIEWED]-(critic)-[:REVIEWED]->(other_bottle)  
WITH  critic, COLLECT(DISTINCT(bottle))) + COLLECT(DISTINCT(other_bottle))) as all_bottles 
RETURN wine_critic, all_bottles
4

1 回答 1

4

尝试:

START shop=node:shops('SHOP_ID:...') 
MATCH (shop)-[:SELLS]->(bottle)<-[:REVIEWED]-(critic)
WITH critic
MATCH (critic)-[:REVIEWED]->(other_bottle)  
RETURN  critic, COLLECT(other_bottle) as all_bottles 
于 2013-09-26T12:25:17.760 回答