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

  • SEARCH
  • Home
  • 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 6550805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:15:38+00:00 2026-05-25T12:15:38+00:00

It will be hard to explain but I’ll try I’ve got a table with

  • 0

It will be hard to explain but I’ll try
I’ve got a table with some fields, and that table got subtable with rows (I’m not talking about SQL, its DB4O, but I use linq). Rows got timefrom and timeto, example:

maintable:
Description,
CreateDate,
....
mainTableRows:
08:00,
09:00,
some description

Now I need to make a query that will sum hours from rows, like this:

09:00-08:00 = 1hour(first row) + 10:00-09:00 (second row)

and so on.

Something like:

var item = from mainTable m 
           select new
             { 
               m.Id, 
               Hours = m.Rows.Sum(c=> new { Hour = c.TimeTo - c.TimeFrom }) 
             }

Thanks all for help, this is mine full solution:

var item = from mainTable m 
               select new
                 { 
                   m.Id, 
                   Hours = String.Format("{0:HH:mm}", (new DateTime((p.TimesheetRows.Aggregate(TimeSpan.Zero, (subtotal, t) => subtotal += (t.TimeTo - t.TimeFrom)).Ticks))))
                 }
  • 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-25T12:15:39+00:00Added an answer on May 25, 2026 at 12:15 pm

    If you want the total elapsed time, you can do:

     var item = from mainTable m 
           select new
             { 
               m.Id, 
               Hours = m.Rows
                        .Select(c => c.TimeTo - c.TimeFrom)
                        .Aggregate( (working, next) => working.Add(next) )
                        .TotalHours
             }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This might be a little hard to explain, but I will try. I want
its hard for me to explain this one, but i hope some code will
It's kinda hard to explain, but I will try my best. I have this
Okay, this will be a bit hard to explain, but I'll try my best.
This is hard to explain but if you go here: https://developers.facebook.com/docs/reference/api/ You will see
This is going to be hard to explain but I'll try my best. I
This is kindy hard to explain, Am looking for an Algorithms that will take
This is hard to explain, but I will do my best: I am building
This is hard to explain but I will do my best. In order to
It's a little hard to explain what I need but i'll try: I need

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.