title: cypher subquery on each node in path
body: <p>In this diagram I would like to find all of the grey nodes circle in red bubble and not any of the other grey nodes.  That is to say all nodes with label :OTHER which are sub nodes of the nodes on the path between A and C.    NB The Path between A and C could be longer than the 3 nodes shown here.</p>
  
  <p><img src="https://i.stack.imgur.com/bRN82.jpg" alt="enter image description here"></p>
  
  <p>So what I want to do is get a path p=A...C and subquery every node in the path for -[:HAS]->(n:OTHER) relationship.  </p>
  
  <p>However I'm stuck on the sub query as it is not acting on result set of the initial query but rather on all nodes. </p>
  
  <p>So this gives me all grey nodes :( and not just the ones in the red bubble.  Please help</p>
  
  <pre><code>match p=(n:MAIN)-[:EXTENDS*]-&gt;(m:MAIN) 
  where n.name = 'A' AND m.name='C' 
  WITH nodes(p) AS collection 
  match (l:MAIN)-[:HAS]-&gt;(u:OTHER) return u;  //This last part is my subquery
  </code></pre>