title: Select first record of a column using LINQ ASP.NET
body: <p>I got one table having fields like <code>Id</code>, <code>Smid</code> and <code>AdditionalComment</code>. I have multiple rows for same <code>Smid</code>, but <code>AdditionalComment</code> data appears only in first row. Please find below for the table structure</p>
  
  <pre><code>Id     |      Smid       |    AdditionalComment
  -------+-----------------+-----------------------
   1     |        2        |       price 4.50 
   2     |        2        |
   3     |        2        |
   4     |        4        |       price 5.00
   5     |        4        |
  </code></pre>
  
  <p>and so on.</p>
  
  <p>Find my code below</p>
  
  <p><strong>CODE</strong></p>
  
  <pre><code>objlist.SMInfoId = smid.ToInt();
  var comment = objlists.GroupBy(x =&gt; x.AdditionalComments).Select(g =&gt; g.First());
  if (comment != null)
  {
    al.Add(comment);
  }
  
  Session["arrayList"] = al;
  </code></pre>
  
  <p>Thank You in advance.</p>