sir*_*dan 5 count relationship neo4j cypher
我有这种关系:
(:User)<-[:MENTIONS]-(:Tweet)-[:ABOUT]->(:Topic)
Run Code Online (Sandbox Code Playgroud)
我想统计推文中提到的有关某些主题的所有用户.
使用以下查询
match (n:Topic)<--(t:Tweet)-[:MENTIONS]->(u:User)
where n.name='politics'
return distinct count(u)
Run Code Online (Sandbox Code Playgroud)
我得到的只是关系计数.
相反,我想要的是提到的用户数量(如果多次提到用户,则没有重复).怎么可能?
尝试使用不同的内部count函数,这样:
match (n:Topic)<-[:ABOUT]-(t:Tweet)-[:MENTIONS]->(u:User)
where n.name='politics'
return count(distinct u)
Run Code Online (Sandbox Code Playgroud)