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

The Archive Base Latest Questions

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

I have a table that tracks the completion of interval tasks. for example, item

  • 0

I have a table that tracks the completion of interval tasks. for example, item a has to be completed every 7 days, item b every 1 days, and so on. The table logs the “nextDue” value on insert. I need a query that will return only the latest “nextDue” dates that are within 3 days of becoming due. This is what I have right now:

SELECT items.id, items.shortDescription, recs.nextDue, sup.name
FROM lut_ResponsibleParties sup INNER JOIN(
     rec_controlCompletion recs INNER JOIN lut_controlItems items
          ON recs.controlItem = items.id)
     ON items.responsiblePerson = sup.id
WHERE datediff("d",Now(),recs.nextDue) <= 3

This was close, except it is returning ALL items that are less than or equal to 3 days, even if the latest completion date is beyond that. Does that make sense? I need the query to only return items based on the latest completion date. I don’t know how else to explain that. Please let me know if I can clarify.

  • 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-24T12:38:36+00:00Added an answer on May 24, 2026 at 12:38 pm

    i think i figured it out somewhere in this jumbled mess:

    SELECT names.shortDescription, names.latestDue, sup.firstName & " " & sup.lastName as fullName
    FROM lut_responsibleParties sup INNER JOIN
    (SELECT items.shortDescription, max.latestDue, items.responsiblePerson
    FROM lut_controlItems items INNER JOIN
    (SELECT recs.controlItem, max(recs.nextDue) as latestDue
    FROM rec_controlCompletion recs
    GROUP BY recs.controlItem) max ON items.id = max.controlItem) names ON sup.id = names.responsiblePerson
    WHERE datediff("d",now(),names.latestDue) <= 3
    ORDER BY names.latestDue
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a History Table in SQL Server that basically tracks an item through
I have a table that contains tasks and I want to give these an
I have a table that has redundant data and I'm trying to identify all
I have a table that tracks serial numbers and the number of licenses associated
I'm working in Sql Server 2005. I have an event log table that tracks
So I have a table that tracks the updating of a projects status. Now
I have this big database table that tracks (currently in production), a persons medical
I have a table (tbl_MatterItem) in my DB that tracks the dates that items
I have a model for a Playlist object that has a number of Tracks.
I have a table that tracks emails sent from applications on my server. 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.