title: Cypher query using foreach
body: <p>I am trying to make relationships between users with same pincode. My data looks like below:</p>
  
  <pre><code>User Pincodes
  A [111,222]
  B [111,333]
  C [333,444]
  D [111,222]
  </code></pre>
  
  <p>So, I want to create relationships between A and B as they have same pincode and another relationship between B an C. I wrote something like below, that is absolutely not what I want.</p>
  
  <pre><code>MATCH (a:User),(b:User)
  WHERE a.pincode=b.pincode
  WITH COLLECT([a,b]) AS its
  FOREACH (pincode IN its |
      CREATE (a)-[r:LIVESINSAMEAREAAS]-&gt;(b)
  );
  </code></pre>