title: Linq group by date when using multiple group by fields
body: <p>Since linq does not allow you to use the Date() method inside a linq query, <strong>I read about using DbFunctions.TruncateTime, which works fine until you try using it inside an anonymous type</strong> which is what I need to do in order to group on multiple fields. I also tried creating a new datetime using just the date portion of my field but this doesn't work either (again with the same error). </p>
  
  <p>My query looks like </p>
  
  <pre><code>kw = kw
      .GroupBy(x =&gt; new { DbFunctions.TruncateTime(g.SummaryHour), x.KeywordID })
      .SelectMany(x =&gt; x)
      .OrderByDescending(x =&gt; x.KeywordID);
  </code></pre>
  
  <p>I tried chaining the group by's together like groupby.groupby... but this doesn't give me the same result. <strong>Any way I can achieve this? I'm basically trying to filter out the time portion of my date and group by other fields as well.</strong></p>