title: GroupBy date portion of DateTime in Linq2db.MySQL C#
body: <p>I am trying to group by the date portion of a DateTime in Linq2db.MySQL. </p>
  
  <p>My first attempt is:</p>
  
  <pre><code>using (var db = MySqlTools.CreateDataConnection(connectionString))
        {
           {
              var query = from t in db.GetTable&lt;Change_log&gt;()
                          .Where(t =&gt; t.Action == 15)
                          .GroupBy(t =&gt; new { t.Change_date.Date, t.Reference_no }).Where(grp =&gt; grp.Count() &gt; 1)
                          .SelectMany(t =&gt; t).ToList()
                          .OrderBy(t =&gt; t.Change_date)
                          select t;
  </code></pre>
  
  <p>But DateTime.Date isn’t recognized. 
  I have tried installing MySQL.Data.Entity and Entity Framework and changing the GroupBy to</p>
  
  <pre><code>.GroupBy(t =&gt; new { dd = DbFunctions.TruncateTime(t.Change_date), t.Reference_no }).Where(grp =&gt; grp.Count() &gt; 1)
  </code></pre>
  
  <p>but then I get the error:</p>
  
  <blockquote>
    <p>‘TruncateTime (convert(selectParm.Change_date))’ Cannot be converted
    to SQL</p>
  </blockquote>
  
  <p>Is this even possible in Linq2db?</p>
  
  <p>Edit:</p>
  
  <p>A proposed solution in another question was to create a function in the database which I have now done(fTruncateTime), returning Date(DateTime), but I don't know how to use it in my GroupBy clause.</p>