Questions tagged [linq-group]
139 questions
0
votes
2 answers
LINQ to SQL grouping and passing onto a view
I am new to Asp.Net, MVC3, Linq, and everything else related to it. I'm very used to PHP and ColdFusion so pardon my ignorance! Essentially what I am trying to do is re-create the situation in ColdFusion where I can perform the equivalent of a…

Vince Ruppert
- 41
- 6
0
votes
0 answers
Linq group by with multiple columns for the outer and then 1 other column for the inner group
Lets say I have a list of class Car. It has properties Id, Model, Year, Age,CarCode. A carCode is unique for a model but is not for all models.
I want to group by Model and Year together and then group that grouping by Age and then for each…

Dino2dy
- 11
- 3
0
votes
1 answer
Group by Columns, and concatenate 1 column, and do the Sum for 1 Column for List
I need to Group by Columns, and concatenate 1 column, and do the Sum for 1 Column.
Group by : 1st by Vendor then by Type
Concatenate by: Month
Sum by :NumberInvoice
This is my code:
using System;
using System.Collections.Generic;
using…

MedAmin
- 35
- 6
0
votes
1 answer
Linq syntax join and group
Hello I need to join two tables (MainTransaction and Subtransaction), the problem here is I also want to get all the record of Maintransaction that's not in the Subtransaction, I am stuck in this part, how can I achieve this ?
protected object…

William
- 5,526
- 6
- 20
- 42
0
votes
1 answer
LINQ query grouping without duplication of data
So I want to display an output that is group by two fields: SubsidiaryCode and AssetCreatedDate. My problem is it displays the grouping values redundantly.
I suspect it duplicates because of my Detail class.
What I want is:
But it displays like…

Its_Me
- 55
- 3
- 7
0
votes
1 answer
group by and joining tables in linq to sql
I have the following 3 classes(mapped to sql tables).
Places table:
Name(key)
Address
Capacity
Events table:
Name(key)
Date
Place
Orders table:
Id(key)
EventName
Qty
The Places and Events tables are connected through Places.Name = Events.Place,…

rescueme
- 69
- 2
- 6
0
votes
1 answer
Access any data that is not contained in grouped element
from teamBudget in TeamBudgets
where teamBudget.TeamID == 71002
join teamBroker in TeamBrokers on 71002 equals teamBroker.TeamID
join goal in Goals on teamBroker.GlobalBrokerID equals goal.GlobalBrokerID
group goal by goal.GlobalBrokerID into…

ilija veselica
- 9,414
- 39
- 93
- 147
0
votes
1 answer
Understanding overloads of GroupBy in Linq
i was going through linq GroupBy extension method and stumbled on one of the overloads which got me confused, now this will yield an result like this
int[] numbers = {1,1,1,2,2,3,4,4,4,4,4,5,5 };
var result = numbers.GroupBy(g =>…

Lijin Durairaj
- 4,910
- 15
- 52
- 85
0
votes
0 answers
Group lines with Numeric and AlphaNumeric (LINQ)
I have a dataset with a column having Numeric and AlphaNumeric Order Nos. Data is being grouped up with different columns which result in merging rows together. Now I want to group lines based on Numeric and AlphaNumeric Order Nos as well, for that…

user3675273
- 1
- 1
- 2
0
votes
1 answer
c# list Group By
I am getting domain related information as a simple list from database and now i need to group the information before binding to the view. Here is my Class details. I tried various group logic but could not get achieve the result
public class…

Karthick Trichy Chandrasekaran
- 444
- 4
- 20
0
votes
1 answer
Linq Group by Sum Lists Elementwise
The list of doubles SC is of same size for all of CTable.
I would like add SC grouped by CTable.Ch. The result should be a List of sums. Is there an operator/customization for that?
Public Class SCRow
Public L As String
Public Ch As String
Public…

Tims
- 627
- 7
- 19
0
votes
1 answer
LINQ Group by; How to make it flexible
considering the bit of code at the bottom, this is my problem:
I want to be able to group revenue based on input, e.g.:
- Year
- Month
- Week
- Units
etc.
Do I need to make a var for each combination (and change the Group by accordingly) or can I…

Rob Jansen
- 59
- 7
0
votes
1 answer
How to create group clause in Entity Framework Core
I am trying to query 2 tables, Club and LinkClubUser. I want to retrieve the last club that a User is assigned from the last Date in the LinkclubUser.
I have the right SQL query:
select top 1
max(A.DataInscricao),
A.Nome, A.NomeNaCamisola,…

jolynice
- 514
- 1
- 8
- 25
0
votes
1 answer
How to group by a price confined to a dynamically generated ceiling?
I have a table of items with several properties but to keep it short, it has property price.
I want to group a List- into groups of price ranges.
The catch is that the price ranges (ceilings ...) have to be dynamically generated.
When the…

Isaac E
- 1,019
- 2
- 8
- 14
0
votes
1 answer
Linq to SQL (Entity Framework) group by work Week number
In Linq to SQL is it possible to group by Week Number of Work week, not weeks from year, for example 1/1/2016 is in the same week of 12/31/2015 it is not the same week of the year (but it is in the same physical week if you will)

Yitzchok Neuhaus
- 26
- 5