title: Using linq group by statement as a subquery
body: <p>I have the following query which works fine:</p>
  
  <pre><code>var bands = new List&lt;TimeBand&gt;()
              {
                  new TimeBand(){Region = 10,PeriodId = 5,StartDate = new DateTime(2013, 04, 01),EndDate = new DateTime(2014, 05, 31),DayName = "Friday",StartTime = "00:00",EndTime = "07:00"},
                  new TimeBand(){Region = 10,PeriodId = 5,StartDate = new DateTime(2013, 04, 01),EndDate = new DateTime(2013, 05, 31),DayName = "Friday",StartTime = "07:00",EndTime = "00:00"},
                  new TimeBand(){Region = 10,PeriodId = 4,StartDate = new DateTime(2013, 06, 01),EndDate = new DateTime(2013, 08, 31),DayName = "Saturday",StartTime = "20:00",EndTime = "00:00"}
              };
  
      var query = (from x in bands
                  group x by new {x.Region, x.DayName}
                  into grp
                      select new TimeBand()
                      {
                          Region = grp.Key.Region,
                          DayName = grp.Key.DayName,
                          StartDate = grp.Min(x =&gt; x.StartDate),
                          EndDate = grp.Max(x =&gt; x.EndDate)
                      }).ToList();
  </code></pre>
  
  <p>But as I group the results by Region and Dayname I am not getting the other columns in my result i.e StartTime and EndTime.</p>
  
  <p>If this was a SQL query I would have used this grouped results in a subquery and get the other columns as well.</p>
  
  <p>Is there any way of modifying this so I also get the properties which are not included in the group by statement.</p>
  
  <p>Thanks</p>