title: How to write LINQ query as one query?
body: <p>I have the following query that groups locations and the average item cost and I would like to write it as one query but I cannot figure out the syntax. What LINQ do I need to do this? I have tried writing it different ways but the syntax is not correct.</p>
  
  <pre><code>        var joinedData =
              from r in shops
              join i in items on r.shopId equals i.shopId 
              select new
              {
                  Region = r.Location,
                  ItemCost = i.ItemCost
              };
  
          var AverageCostByLocation = joinedData
              .GroupBy(m =&gt; new { m.Location})
              .Select(m =&gt; new
              {
                  Location= m.Key.Location,
                  AverageItemCost = m.Average(x =&gt; x.ItemCost)
              });
  </code></pre>