2017-04-07 52 views
0

我有两种类型的节点:(n:type1) - [r] - >(m:type2)。 type1节点有一个名为“True”或“False”的属性。我想要一个查询,为类型2的每个节点,从与其相关的节点给出True和False的总和。带有密码的双向制表,neo4j

我可以分两次做到这一点:

match (n:type1)-[r]->(m:type2) where n.called return m.id, count(n); 
match (n:type1)-[r]->(m:type2) where not n.called return m.id, count(n); 

但是我想能够做到这一点的一个查询。

回答

1

试试这个

match (n:type1)-[r]->(m:type2) 
return m.id, n.called, count(n); 
+0

感谢。像魅力一样工作。 – Placidia