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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:03:37+00:00 2026-06-17T20:03:37+00:00

I have a issues table where users can log worked hours and estimate hours

  • 0

I have a issues table where users can log worked hours and estimate hours that looks like this

id |  assignee  |  task   |   timespent  |  original_estimate | date
--------------------------------------------------------------------------
1  |  john      |  design |   2          |  3                 | 2013-01-01
2  |  john      |  mockup |   2          |  3                 | 2013-01-02
3  |  john      |  design |   2          |  3                 | 2013-01-01
4  |  rick      |  mockup |   5          |  4                 | 2013-01-04

And I need to sum and group the worked and estimated hours by task and date to get this

assignee  |  task   | total_spent   | total_estimate  |  date
------------------------------------------------------------------
john      |  design | 4             | 6               | 2013-01-01
john      |  mockup | 2             | 3               | 2013-01-02
rick      |  design | 5             | 4               | 2013-01-04

Ok, this is easy, I’ve already got this:

SELECT assignee, task, SUM(timespent) as total_spent, SUM(original_estimate) AS total_estimate, date FROM issues GROUP BY assignee, task, date

My problem is I need to also show the assignees that did not logged hours on any task that day, I mean:

assignee  |  task   | total_spent   | total_estimate  |  date
------------------------------------------------------------------
john      |  design | 4             | 6               | 2013-01-01
john      |  mockup | 2             | 3               | 2013-01-02
rick      |  design | 5             | 4               | 2013-01-04
pete      |  design | 0             | 0               | 2013-01-01
pete      |  mockup | 0             | 0               | 2013-01-02
liz       |  design | 0             | 0               | 2013-01-04
liz       |  mockup | 0             | 0               | 2013-01-04

The goal is to draw a chart like this http://jsfiddle.net/uUjst/embedded/result/

  • 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-17T20:03:38+00:00Added an answer on June 17, 2026 at 8:03 pm

    Assuming that you have a user table, but not a tasks or dates table… meaning that we have to derive these values from the values present in issues:

    ;WITH dates AS (
        SELECT DISTINCT date
        FROM issues
    ), tasks AS (
        SELECT DISTINCT task
        FROM issues
    )
    SELECT 
        u.user as assignee, 
        t.task, 
        SUM(i.timespent) as total_spent, 
        SUM(i.original_estimate) AS total_estimate, 
        d.date 
    FROM 
        users u CROSS JOIN
        dates d CROSS JOIN
        tasks t LEFT OUTER JOIN
        issues i ON
            i.assignee = u.user
            AND i.task = t.task
            AND i.date = d.date
    GROUP BY u.user, t.task, d.date
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a collection of users like this:- { _id : 1234, Name
I have a dynamic table where users can add and delete rows. When the
I have started this support ticket project where users can create tickets and the
I have an HTML table with one column being email addresses; spambot issues aside,
My issue is that I have created a table for a local db in
I have a pretty common layout issue that I have traditionally used a table
I'm seeing basically the same issue described here I have a table that starts
I'm having an issue bending my head around this one. I have a table
I have got one issue. Can some one please help me to resolve this?
This issue I am having is that my program can only send my string

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.