title: C# LINQ Select JOIN GroupBy is not working
body: <p>I am using entityFramework Core and got a LINQ query select, inner join, where and got the results. I need to add GroupBy and it an error. I followed a few posts and mimic their code but I have been stucked.</p>
  <p>I am having issue with translating to LINQ</p>
  <p>Here is my linq that is working without the GroupBy</p>
  <pre><code>var result = this.myDbContent.Table1
                 .Join(this.Table2,
                       table1 =&gt; table1.myId,
                       table2 =&gt; table2.myId,
                       (table1 ,table2) =&gt; {table1 ,table2}
                 )
                 .Join(this.Table3,
                       table1_table2 =&gt; table1_table2.table1.myId,
                       table3 =&gt; table3.myId,
                       (table1_table2 ,table3) =&gt; {tabtable1_table2 e1 ,table3}
                 )
                 .Where(
                   s =&gt; s.table1_table2.table1.myId == 1 &amp;&amp;
                   s.table1_table2.table2.isCompleted == true
                 )
                 .Select(s =&gt; new
                 {
                    MyID = s.table1_table2.table1.myId,
                    MyDate = s.table1_table2.Table2.CompletedDate
                 });
  </code></pre>
  <p>This query works and returns records</p>
  <p>In the following I added the GroupBy according to another post</p>
  <pre><code>var result = this.myDbContent.Table1
                 .Join(this.Table2,
                       table1 =&gt; table1.myId,
                       table2 =&gt; table2.myId,
                       (table1 ,table2) =&gt; {table1 ,table2}
                 )
                 .Join(this.Table3,
                       table1_table2 =&gt; table1_table2.table1.myId,
                       table3 =&gt; table3.myId,
                       (table1_table2 ,table3) =&gt; {tabtable1_table2 e1 ,table3}
                 )
                 .Where(
                   s =&gt; s.table1_table2.table1.myId == 1 &amp;&amp;
                   s.table1_table2.table2.isCompleted == true
                 )
                 .GroupBy(s =&gt; new
                   {
                      MyID = s.table1_table2.table1.myId,
                      MyDate = s.table1_table2.Table2.CompletedDate
                   }
                 )
                 .Select(s =&gt; new
                 {
                    MyID = s.Key.myId,
                    MyDate = s.Key.CompletedDate,
                    Count = s.Count()
                 });
  </code></pre>
  <p>When I run this query with the GroupBy, I get an&quot;SYstem.InvalidOperationException</p>
  <p>I am trying to add the following SELECT GROUPBY to the working QUERY</p>
  <pre><code>Select Count(*) AS Counts, MyID, MYDATE
  FROM ( the working query above )
  GROUP BY MyID, MYDATE
  </code></pre>
  <p>Thanks</p>