Neo4j group relationships between node
<p>I need to retrieve all relationships between 2 nodes grouped and I currently have this code, but the issue is I get multiple rows for each pair</p>

<pre><code>MATCH (n)-[r]-&gt;(m)
WHERE n.name = '${query}' or 
      m.name = '${query}' 
RETURN n, m, COUNT(r.aa) as aa, COUNT(r.bb) as bb
</code></pre>

<p>For example if I have <strong>x-aa[1,2,3]->y</strong> and <strong>x-bb[1,2,3]->y</strong> I will get 2 rows<br>
x, y, 3, 0<br>
x, y, 0, 3<br>
and what I want is to get 1 row with the combination of the 2<br>
x, y, 3, 3</p>