Questions tagged [linq-group]

139 questions
0
votes
1 answer

Grouping 4 Tables using Linq

I have the following requirements: One rating can have zero or many RatingPictures One Rating can have zero or many Comments One Comment belongs to one User This is what I have so far: from rating in Ratings where rating.LocationID == 1007 …
Christopher Wilke
  • 65
  • 1
  • 1
  • 10
0
votes
1 answer

Per Invoice show string/int array of unique products

I have a list of Invoices and all the Products on each Invoice. Each Invoice can have multiples of the same product class InvoiceProducts { public int InvoiceID { get; set; } public int ProductID { get; set; } } var list = new…
Peter PitLock
  • 1,823
  • 7
  • 34
  • 71
0
votes
1 answer

How to group more than two tables using Linq

I have three tables ("Ratings", "Comments" and "Users"). One rating can have multiple comments. One comment belongs to one user. So far, I have this LINQ statement which is working fine. from rating in Ratings join comment in Comments on rating.ID…
Christopher Wilke
  • 65
  • 1
  • 1
  • 10
0
votes
1 answer

Group a datatable by sequential values

I have a table with 2 columns clmAge and clmPrice like Age Price 1 , 100 2 , 100 3 , 150 4 , 150 5 , 100 6 , 100 7 , 100 Prices might be the same for different ages, and I need the min and max age that are for all consecutive ages…
Yannis
  • 37
  • 9
0
votes
1 answer

combining join and group into using LINQ

I am not able to display a table like this classId class name frequency 1 basic one 2 2 basic two 1 I have a model like this to use to display frequency , classsId and class name. the classsId is a primary…
0
votes
1 answer

Linq to sum on groups based on two columns

I have a class as below: Class Financial { string Debit; string Credit; decimal Amount; } And I have a list with objects of this class, with multiple records. All I need is to perform a groupped sum, something like in sql Select debit,…
bzamfir
  • 4,698
  • 10
  • 54
  • 89
0
votes
1 answer

Lambda Linq Iqueryable group - add another grouping

I have a method that I use for generating a summary report, based on the options a user selects in pick lists, to count the number of a type of test that is completed in a region, with subset locations, within a date range. Here's what the data…
Jennifer S
  • 1,419
  • 1
  • 24
  • 43
0
votes
1 answer

An issue with LINQ Group by query

I have a query which works fine private ObservableCollection> MonkeysGrouped { get; set; } var sorted = from item in CollPublic orderby item.Title …
Supreet
  • 831
  • 1
  • 9
  • 30
0
votes
1 answer

linq query to group the items

var sales = _salesService.GetSales(parameters) The list is something like var listSales = new List(); listSales .Add(new SalesData { Name = "Apple", Quantity = 1000 }); listSales .Add(new SalesData { Name = "Banana", …
0
votes
1 answer

Linq Group on a multi-level object with select statement

I've got 3 dataset objects that are nested with each other using entity set objects. I am selecting the data like this var newList = from s in MainTable from a in s.SubTable1 where a.ColumnX = "value" from b in a.Detail where b.Name =…
Mad Halfling
  • 968
  • 3
  • 19
  • 36
0
votes
2 answers

How do you change a linq group IQueryable> to IQueryable?

How do you change a linq group IQueryable> to IQueryable ? So that i can join the iqueryable with other entities?
yohannist
  • 4,166
  • 3
  • 35
  • 58
0
votes
2 answers

Linq Group By Query not cutting it

The venerable "group by" option nicely handles multiple group by fields. The Problem : What if I want to include field(s) in the result set (that don't need to be grouped by) that are not in the group by (grp) object. Based on the gazillion…
user2284452
  • 115
  • 1
  • 11
0
votes
2 answers

Linq Group Join Items into List

It's a master detail scenario, where each TABLE1 has multiple rows from TABLE2 assigned and I want to do something lihe this: From a In TABLE1 Group Join c In TABLE2 On c.ID2 Equals a.ID Into Group Select New ViewModel1 With { .COLUMN1 =…
John
  • 1,327
  • 1
  • 17
  • 28
0
votes
3 answers

Group a list of objects and assign values to groups

class user { public string userID { get; set; } public string groupID { get; set; } public int individualCredit { get; set; } public int groupCredit { get; set; } } I have a list like this List listUsers = new…
Sahil
  • 137
  • 1
  • 1
  • 12
0
votes
1 answer

Sort and allocate objects in a list

class user { public string userID { get; set; } public string groupID { get; set; } public int individualCredit { get; set; } public int groupCredit { get; set; } } I have a list like this List listUsers = new…
Sahil
  • 137
  • 1
  • 1
  • 12