title: LINQ vb.net GROUP BY - SELECT JOINED column
body: <p>I have a very basic SQL query I am trying to reproduce:</p>
  
  <pre><code>     SELECT t1.id, t1.name, count(*), min(t2.inserted) as inserted_first,        max(t2.inserted) as inserted_last
       FROM tbl1 t1 
       LEFT JOIN tbl2 t2 ON t1.id=t2.tbl1_id
       WHERE t2.search=15
       GROUP BY t1.id, t1.name
  </code></pre>
  
  <p>This works perfect for me.  It allows me to group by the unique items of t1.id and t1.name, but also get the amount of times this pair appears, and also the min and max value of t2.inserted for the linked table.  Problem is, now when I turn this into LINQ I get:</p>
  
  <pre><code>    Dim query =
      From t1 In ent.TBL1
      Join t2 In ent.TBL2 On t1.id Equals t2.tbl1_id
      Where (t2.search=15)
      Group t1 By t1.id, t1.name Into Group
      Select New With {
       .id = id,
       .name = name,
       .count = Group.Count,
       .min_value = ???,
       .max_Value = ???
      }
  </code></pre>
  
  <p>I am lost as to what i can do to select the min and max.  Group.Min would work if it was of the same table as the grouping, however since it is in t2, I am not able to reference it.   Also I can not add it to my group by, since its different.</p>
  
  <p>Note that tbl2 links to tbl1 on tbl2.tbl1_id -> tbl1.id.  Also this is a dumbed down example of my problem, not the real live schema.</p>
  
  <p>I appreciate any help on this matter</p>