title: C#/LINQ & Infamous ORA-00933: SQL Command not properly ended
body: <p>I have the following C#/LINQ statement (using Visual Studio 2010) that gives me the above error:</p>
  
  <pre><code>var cityResults = TaxRates
      .Where(a =&gt; a.TaxType.Equals("CI"))
      .OrderBy(a =&gt; a.Description).ThenByDescending(a =&gt; a.CreateDate)
      .GroupBy(a =&gt; a.Description)
      .Select(grp =&gt; grp.FirstOrDefault());
  </code></pre>
  
  <p>I simply want the query to bring back all the columns from the TaxRates table, grouped by DESCRIPTION and bring back the most recent CREATEDATE row. </p>
  
  <p>Running Oracle 9i. </p>
  
  <p>For what's it's worth, the following works just fine and brings back exactly what I want:</p>
  
  <pre><code>var cityResults = TaxRates
      .Where(x =&gt; x.TaxType.Equals("CI"))
      .OrderByDescending(x =&gt; x.CreateDate)
      .GroupBy(x =&gt; x.Description)
      .Select(x =&gt; x.First());
  </code></pre>
  
  <p>However, this is because I'm using the below data structure instead of going against a database/table:</p>
  
  <pre><code>public static List&lt;MyCities&gt; TaxRates = new List&lt;MyCities&gt;
  {
  new MyCities {Description = "Boston",    TaxType = "CI", CreateDate = 120, TaxAmt = 5.7},
  new MyCities {Description = "Houston",   TaxType = "CI", CreateDate = 116, TaxAmt = 5.7},
  new MyCities {Description = "Boston",    TaxType = "CI", CreateDate = 121, TaxAmt = 5.6},
  new MyCities {Description = "Las Vegas", TaxType = "CI", CreateDate = 114, TaxAmt = 5.7},
  new MyCities {Description = "Boston",    TaxType = "CI", CreateDate = 115, TaxAmt = 5.9},
  new MyCities {Description = "Phoenix",   TaxType = "CI", CreateDate = 118, TaxAmt = 5.7},
  new MyCities {Description = "Colorado",  TaxType = "ST", CreateDate = 113, TaxAmt = 5.7},
  new MyCities {Description = "Seattle",   TaxType = "CI", CreateDate = 112, TaxAmt = 5.7},
  new MyCities {Description = "Orlando",   TaxType = "CI", CreateDate = 111, TaxAmt = 5.7},
  new MyCities {Description = "Miami",     TaxType = "CI", CreateDate = 119, TaxAmt = 5.7},
  new MyCities {Description = "Boston",    TaxType = "CO", CreateDate = 122, TaxAmt = 5.7},
  new MyCities {Description = "Eugene",    TaxType = "CI", CreateDate = 121, TaxAmt = 5.7}
  };
  
  public class MyCities
  {
      public string Description { get; set; }
      public string TaxType { get; set; }
      public int CreateDate { get; set; }
      public double TaxAmt { get; set; }
  }
  </code></pre>