title: Is it possible to aggregate a join as a comma seperated list in Entity Framework
body: <p>I have a table Users, and a table Phone.</p>
  
  <p>A user can have multiple phone numbers. So the return of a join might look like this:</p>
  
  <pre><code>|   name   |  phonenr    |
  |----------|-------------|
  |  Eve     |  00123      |
  |  Eve     |  00145      |
  |  Eve     |  00125      |
  |  Eve     |  00245      |
  |  Bob     |  00147      |
  |  Bob     |  00159      |
  |  Bob     |  00258      |
  </code></pre>
  
  <p>However this creates many similar rows, because a user can have so many rows. Is it possible to return something like this:</p>
  
  <pre><code>|   name   |          phonenr            |
  |----------|-----------------------------|
  |  Eve     |  00123, 00145, 00125, 00245 |
  |  Bob     |  00147, 00159, 00258        |
  </code></pre>
  
  <p>I am using Linq and Entity Framework 6 though. My query looks something like this:</p>
  
  <pre><code>(from user in context.Users
   orderby user.Id
   select new User{
       id = user.id,
       name = user.name,
       phonenr = (from nr in context.Phone
                  where nr.userid.Equals(user.id)
                  select nr.Number).ToList()
  }).ToList();
  </code></pre>