 <p>I think this code is correct.</p> <pre><code>var hotels1 = tb_hotel.Join(tb_room_hotel, chid =&gt; chid.HotelID, crid =&gt; crid.HotelID, (chid, crid) =&gt; new { chid, crid }) .Where(x =&gt; x.crid.tb_Language.Title == lang &amp;&amp; x.chid.ActionState != 0) .GroupBy(t =&gt; new { HID = t.chid.HotelID }) .Select(g =&gt; new { Average = g.Average(p =&gt; p.crid.Price), HID = g.Key.HID }).OrderBy(c =&gt; c.Average).ToList(); </code></pre>