title: EF for Top 10 most popular locations c#
body: <p>I have a table tbLocations with the following columns:</p>
  
  <pre><code>int           id      {PRIMARY_KEY, AUTO_INCREMENT}
  int           userid  {Foreign key with table_users}
  varchar(200)  location
  </code></pre>
  
  <p>In this table I have the following rows:</p>
  
  <pre><code>1, 1, New York
  2, 1, California
  3, 1, Seattle
  4, 1, New York
  5, 2, Seattle
  6, 2, Ontario
  7, 3, Chicago
  8, 4, Las Vegas
  9, 5, New York
  </code></pre>
  
  <p>I want to create a c# linq query that gets me the top 10 locations, in my case I should get</p>
  
  <pre><code>New York  2
  Seattle   2
  </code></pre>
  
  <p>The issue here is that a location can be duplicate for a user <code>i.e. New York is duplicate for userid 1</code> so I don't want such duplication to affect the final report.</p>
  
  <p>Like in the final report I have New York =2 and not =3</p>
  
  <p>How can I do this in LINQ?</p>
  
  <p>I really have no idea where to start, I tried by grouping by but that didn't work</p>