title: LINQ : understanding and executing Groupby to bring back unique rows?
body: <p>i am trying to do a groupby in linq, basically i have a list ( along list - around 1000 entries) and i wish to groupby Description.</p>
  
  <p>The entries are vehicles, so hence there are 50 or so Ford Mondeos</p>
  
  <p>My query is pretty simple, no joins (yet :-) ) but it brings back a list including 50 Ford Mondeos, i wanted it to group them so there is only 1 entry.</p>
  
  <p>I am only selecting Description, i am not selecting the IDs which would be different, but in LinqPad it returns the desc and i can see 50 ford mondeos that are all the same in description - letter for letter.</p>
  
  <p>What am i doing wrong?</p>
  
  <pre><code>from v in dc.Vehicles
     group v by v.Description into g1
  from y in g1
     orderby y.Description 
  select new
  {
       Desc = y.Description 
  };
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>It now brings back just 1 record for each ford mondeo, this was my test to ensure it worked but i need to expand on this, again it should only bring back 1 record each for ford mondeo as i have checked they all have same number of doors, categor, model id etc..</p>
  
  <pre><code>from v in dc.Vehicles
    group v by v.Description into g1
  orderby g1.Key
    select new
    {
       Desc = g1.Key,
       CategoryId = g1.CategoryId,
       MakeId = g1.MakeId,
       ModelId = g1.ModelId,
       Doors = g1.Doors,
    };
  </code></pre>
  
  <p>Of the course the above doesn't work it doesn't find all the other fields i.e. CategoryId... i tried separating the group by and adding a comma for the other fields..</p>
  
  <p>I think i have a little confusion over the key, i understand that this is the key but if you are grouping on more than 1 fields then potentially you would have more than 1 key..</p>
  
  <p>Any ideas?</p>