title: Groupby and where clause in Linq
body: <p>I am a newbie to Linq. I am trying to write a linq query to get a min value from a set of records. I need to use groupby, where , select and min function in the same query but i am having issues when using group by clause. here is the query I wrote</p>
  
  <pre><code>var data =newTrips.groupby (x =&gt; x.TripPath.TripPathLink.Link.Road.Name)
                    .Where(x =&gt; x.TripPath.PathNumber == pathnum)
                    .Select(x =&gt; x.TripPath.TripPathLink.Link.Speed).Min();
  </code></pre>
  
  <p>I am not able to use group by and where together it keeps giving error .</p>
  
  <p>My query should </p>
  
  <ol>
  <li>Select all the values. </li>
  <li>filter it through the where clause (pathnum).</li>
  <li>Groupby the road Name</li>
  <li>finally get the min value.</li>
  </ol>
  
  <p>can some one tell me what i am doing wrong and how to achieve the desired result.</p>
  
  <p>Thanks, 
  Pawan</p>