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 8182969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:01:08+00:00 2026-06-07T01:01:08+00:00

I have to get the sub total of time spent in SQL any ideas?

  • 0

I have to get the sub total of time spent in SQL any ideas?

This is just a simple example of my query.

`SELECT 
   A.INDX, B.CLIENTNAME, C.PROJECTNAME, D.NAME, 
   CONVERT(CHAR(10), A.CDATE, 101) [DATE],
   CONVERT(TIME(0), A.START_TIME, 108) [START],
   CONVERT(TIME(0), A.END_TIME, 108) [END],
   CONVERT(TIME(0), (A.END_TIME - A.START_TIME ), 108) [HOURS_WORKED]
FROM 
   LOGSHEET A, CLIENTS B, PROJECTS C, DEVELOPERS D
WHERE B.CLIENTNO = 1
  AND C.PROJECTID = 11
  AND D.USERID = 1`

The total should be under hours worked

Dropped my logsheet table

`BEGIN CREATE TABLE [dbo].[LOGSHEET](
[INDX] [int] IDENTITY(1,1) NOT NULL,
[CLIENTNO] [int] NULL,
[PROJECTID] [int] NULL,
[USERID] [int] NULL,
[CDATE] [datetime] NULL,
[START_TIME] [datetime] NULL,
[END_TIME] [datetime] NULL) ON [PRIMARY]END GO`

basically what I Need

name | start time | End time | Hours_worked |

AJ……| 07:00:00 | 07:15:00 | 00:15:00 |

AJ …..| 07:00:00 | 07:15:00 | 00:15:00 |

            Total:   |00:30:00|
  • 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-06-07T01:01:08+00:00Added an answer on June 7, 2026 at 1:01 am

    Ok well I figured out an solution to my problem by just adding a field “MINUTES” and running the query from c#

    if (e.CommandName == "Stop") {
        int row = int.Parse(e.CommandArgument.ToString());
        string indx = GridView1.Rows[row].Cells[1].Text; 
        string s = null;
        s = "UPDATE LOGSHEET ";
        s += "SET MINUTES = (DATEPART(HOUR,TIME_SPENT)*60)+(DATEPART(MINUTE,TIME_SPENT)) ";
        s += "WHERE INDX = @p0 ";
    
    
        String[] pr = new String[1];
        pr[0] = indx; 
    
        cQ.execSql(s, pr);
    
      }
    }
    

    witch gives me the minutes as int and then just run

    protected string GetTotal() {
      string userid = Session["id"].ToString();
      string s = null;
    
    
      s = "SELECT SUM(MINUTES) ";
      s += "FROM LOGSHEET ";
      s += "WHERE USERID = @p0 ";
    
      String[] pr = new String[1];
      pr[0] = userid;
    
      return cQ.GenQuery(s, pr);
    }
    

    followed by

    label5.text = GetTotal();
    

    and KABOOM done sum of all time spent in minutes problem solved

    this is a C# program but I needed the SQL queries to solve it

    THANKS to the people that Helped!!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query: select e.Owner as 'Owner', COUNT(l.EnquiryID) as 'Total Sales Lines' from
I have MySQL query like this SELECT `transaction`.id, CONCAT(contact.`name`, , contact.last_name) as fullName, (SELECT
I have a collection of Objective-C classes that get sub-classed at a variety of
Suppose I was given a URL. It might already have GET parameters (e.g. http://example.com/search?q=question
I have to get a part of my content provider query in a String[]
================= This is my query: SELECT SUM(sub_total) AS sales, CASE WHEN (sub_total<100) THEN '0-99'
I'm doing a probability calculation. I have a query to calculate the total number
I have the following (fairly legacy, did this a year or two ago) SQL
I have this Perl/CGI to upload files and get the uploaded file size while
ASP.NET 3.5 & SQL 2008 I have this main table & a subtable. For

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.