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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:23:32+00:00 2026-06-18T16:23:32+00:00

Given a big table of data about when people begin and complete tasks, e.g:

  • 0

Given a big table of data about when people begin and complete tasks, e.g:

Person  |  Task | Date started | Date ended
---------------------------------------------
A        Cleaning  20-FEB-2012  22-FEB-2012
N        Dishes    20-FEB-2012  24-FEB-2012
Z        Cleaning  21-FEB-2012  23-FEB-2012

and a score table which assigns scores of 2,3,4 for each task based on how long it takes them to do it, e.g.:

|  Task | Days taken | Score
---------------------------
Cleaning      2        2
Cleaning      1.5      3
Cleaning      1        4
Dishes        3        2
Dishes        2.5      3
Dishes        2        4

how might I produce a query which gives the overall score for each person for each task, e.g.:

Person  |  Task | Overall Score
---------------------------------------------
A        Cleaning  3.1
A        Dishes    2.7
N        Cleaning  3.4

The solution’s been subtly eluding me, some assistance would be appreciated! I’m using SQLite at present.

  • 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-18T16:23:33+00:00Added an answer on June 18, 2026 at 4:23 pm

    Your definitions are a bit vague. However, the following should help you:

    select t.person, t.task, sum(s.score)
    from tasks t left outer join
         score s
         on t.task = s.task and
            s.daysTaken = t.julianday(dateended) - t.julianday(datestarted)
    group by t.person, t.task
    

    Handling ranges a bit more difficult. You need to get the two ends of the interval, and then do the join:

    select t.person, t.task, sum(s.score)
    from tasks t left outer join
         (select s.*,
                 (select min(days_taken) from score s2 where s2.person = s.person and s2.task = s.task and s2.days_taken > s.days_taken
                 ) as nextDays_Taken
          from score s
         ) s
         on t.task = s.task and
            t.julianday(dateended) - t.julianday(datestarted) >= s.days_taken and
            t.julianday(dateended) - t.julianday(datestarted) < nextDays_Taken
    group by t.person, t.task
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given a big city (square is about 800 km^2 ) with some layer over
Given a MySQL table of real estate data, I would like to generate a
I have a big Table , about 1 million records , and it's increasing
I have a data.table that is not very big (2 GB) but for some
Given a relatively big home-grown framework written in .NET. For an additional lower priority
Given a certain date, I want to set the value of a cell with
I have a big fat query that's written dynamically to integrate some data. Basically
I have this big table called StateChanges (1.9 million rows) from a third party
Up until now the MVC separation hasn't given me any big problems, but I
I'm using pyodbc to data-mine a big database in a .mbd (access) file. I

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.