neo4j添加返回改变匹配的节点数量
我正在尝试进行搜索以获得一些基本数据。
MATCH(l:letter)-[:RECIPIENT]-(a:address{country: "England"})
RETURN a
结果 = 56
注意
处理信件时,如果数据库中尚不存在该地址,则添加该地址;如果已存在,则添加关系已创建到现有节点。 因此,这里不应该存在不连接到 letter
节点的地址,尽管 relationship
可能是 sender
而不是 recipient< /代码>。
如果我添加字母计数,我会得到不同的地址计数。
MATCH(l:letter)-[:RECIPIENT]-(a:address{country: "England"})
RETURN a, l
结果 - a = 2, l = 298
同样,如果我只返回字母,我会再次得到不同的数字。
MATCH(l:letter)-[:RECIPIENT]-(a:address{country: "England"})
RETURN l
结果 - l = 300
我错过了什么?
我以为MATCH
定义了查询,而RETURN
只是选择显示哪些部分的信息,RETURN
如何改变匹配的数据?
I am trying to perform a search to get some basic figures.
MATCH(l:letter)-[:RECIPIENT]-(a:address{country: "England"})
RETURN a
Result = 56
Note
When a letter is processed, the address is added if it is not already on the database, if it already exists, a relationship is created to the existing node.
Therefore, no address should exist here that does not connect to a letter
node, although the relationship
could be sender
rather than recipient
.
If I add a count for letters, I get a different address count.
MATCH(l:letter)-[:RECIPIENT]-(a:address{country: "England"})
RETURN a, l
Result - a = 2, l = 298
Likewise, if I return only letters, I get different figure again.
MATCH(l:letter)-[:RECIPIENT]-(a:address{country: "England"})
RETURN l
Result - l = 300
What am I missing?
I thought that the MATCH
defines the query, and the RETURN
is just choosing which parts of the information to display, how does RETURN
alter the matched data?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要获取字母节点的总数,您需要添加 DISTINCT。
当您开始组合结果中的字母和地址时,您最终将得到每行的聚合结果。
To get the total number of nodes that are letters, you need to add DISTINCT.
When you start combining the letters and addresses in your results you will end up with aggregates per row.