title: VB.Net Converting Lamda to SQL
body: <p>I've spent the entire day trying to convert this VB.Net code into SQL script. The goal is to remove the VB code and switch to stored procedures:</p>
  
  <pre class="lang-vb prettyprint-override"><code>Dim hashmap = getHashMap()
  Dim x = hashmap.Where(Function(i) Not i.Name.ToLower.Contains("john"))
  Dim y = x.GroupBy(Function(i) i.City)
  Dim z = y.Select(Function(grp) grp.First()).ToList
  </code></pre>
  
  <p>So far, I've translated everything but the last line (<code>Dim z = y.Select(Function(grp) grp.First()).ToList</code>):</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT City FROM hashmap WHERE LOWER(Name) NOT LIKE '%john%' GROUP BY City
  </code></pre>