Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6073721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:18:08+00:00 2026-05-23T10:18:08+00:00

I have the below Linq query that is returning the data but I need

  • 0

I have the below Linq query that is returning the data but I need to aggregate the columns to group on the Period and Sum the Count columns.

How do I go about doing this?

LINQ

from t In tblTimes
    join h In tblEngineeringDashboard_CADMachinesCounts on t.ID Equals h.TimeID
                   Order By t.Period
                   Group By t.Period, h.Count Into Group
                   select Period, Count

DATA

Period                  CountΞΞ 
01/01/2010 00:00:00     0
01/01/2010 00:00:00     1
01/01/2010 00:00:00     2
01/01/2010 00:00:00     3
01/01/2010 00:00:00     5
01/01/2010 00:00:00     6
01/01/2010 00:00:00     7
01/01/2010 00:00:00     9
01/01/2010 00:00:00     11
01/01/2010 00:00:00     12
01/01/2010 00:00:00     14
01/01/2010 00:00:00     15
01/01/2010 00:00:00     17
01/01/2010 00:00:00     21
01/01/2010 00:00:00     22
01/01/2010 00:00:00     30
01/01/2010 00:00:00     31
01/01/2010 00:00:00     34
01/02/2010 00:00:00     0
01/02/2010 00:00:00     1
01/02/2010 00:00:00     2
01/02/2010 00:00:00     3
01/02/2010 00:00:00     5
01/02/2010 00:00:00     6
01/02/2010 00:00:00     7
01/02/2010 00:00:00     9
01/02/2010 00:00:00     12
01/02/2010 00:00:00     14
01/02/2010 00:00:00     15
01/02/2010 00:00:00     17
01/02/2010 00:00:00     21
01/02/2010 00:00:00     23
01/02/2010 00:00:00     30
01/02/2010 00:00:00     34

etc

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:18:09+00:00Added an answer on May 23, 2026 at 10:18 am

    Assuming you have retrieved your records from the database into an enumerable variable named ‘PeriodRecords’ you could use the following Linq statement to get the individual periods and the sum of count per period.

     var countsPerPeriod =
          from row in PeriodRecords      
          group row by row.Period into g
          select new {Period = g.Key, TotalPeriodCount = g.Group.Sum(row => row.Count)};
    

    You can then iterate over your new “countsPerPeriod” variable as follows;

    foreach(var periodCount in countsPerPeriod) {
        var period = periodCount.Period;
        var count  = periodCount.TotalPeriodCount;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a linq query that creates the anonymous type below: select new
I have the below LINQ that is returning zero IF there aren't any Addresses(Inner
I have a query that should always be returning a single int. I have
I have the below linq query which takes a text field which may be
I have a LINQ query that populates a list of designers. Since I am
Let's say I have a linq query like the one below var LinqResult =
I have the below query, which basically it retrieves the 5 top most books
I am trying to learn more about regular expressions I have one below that
I'm trying to figure out why a simple query in LINQ is returning odd
I have a fairly complicated join query that I use with my database. Upon

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.