---
title: "Linq group by"
type: "forum-thread"
url: "https://www.webforum.nu/amne/dotnet/171712-linq-group-by"
topic: ".NET"
topic_url: "https://www.webforum.nu/amne/dotnet"
author: "Bjuris"
published: "2008-05-22T12:25:16.000Z"
updated: "2008-05-22T12:25:16.000Z"
replies: 0
views: 493
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/dotnet/171712-linq-group-by"
---

# Linq group by

## #1 — Bjuris, 2008-05-22T12:25Z

Har lite problem med att få Group By fungerar i Linq.

```
 var result = from location in this.MyPlan_Answers
                     join bases in this.MyPlan_Bases on location.MyPlan_Goal.BaseId equals bases.BaseId
                     where location.StudentId == studentId
                     orderby location.CreatedBy
                     group location by new { location.CreatedBy } into grouping
                     //select location
                     select new SavedReports
                     {
                         CreatedBy = Membership.GetUser(grouping.Key.CreatedBy).UserName,
                         Completed = [B]Här skulle jag vilja hämta location.completed[/B] 
                     };
```

 

När jag kör group by så får jag ju bara med CreatedBy till min nästa select fråga.
Hur kan jag få med mig allt det gamla (location)?

Permalänk: https://www.webforum.nu/p/171712

---

Tråden på webben: https://www.webforum.nu/amne/dotnet/171712-linq-group-by
