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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:51:02+00:00 2026-06-16T19:51:02+00:00

I have a scenario where I need to pull up delivery dates based on

  • 0

I have a scenario where I need to pull up delivery dates based on a table below (Example)

job_id | delivery_date
1      | 2013-01-12
2      | 2013-01-25
3      | 2013-02-15

What I’m trying to do is show the user all the delivery dates that start with the earliest (in this case it would be 2013-01-12) and add an another 21 days to that. Basically, the output I would expect it to show of course, the earliest date being the starting date 2013-01-12 and 2013-01-25. The dates past the February date are of no importance since they’re not in my 21 date range. If it were a 5 day range, for example, then of course 2013-01-25 would not be included and only the earliest date would appear.

Here is main SQL clause I have which only shows jobs starting this year forward:

SELECT date, delivery_date 
FROM `job_sheet` 
WHERE print_status IS NULL 
    AND job_sheet.date>'2013-01-01'

Is it possible to accomplish this with 1 SQL query, or must I go with a mix of PHP as well?

  • 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-16T19:51:03+00:00Added an answer on June 16, 2026 at 7:51 pm

    You can use the following:

    select *
    from job_sheet
    where print_status IS NULL
      and delivery_date >= (select min(delivery_date)
                            from job_sheet)
      and delivery_date <= (select date_add(min(delivery_date), interval 21 day)
                            from job_sheet)
    

    See SQL Fiddle with Demo

    If you are worried about the dates not being correct, if you use a query then it might be best to pass in the start date to your query, then add 21 days to get the end date. Similar to this:

    set @a='2013-01-01';
    
    select *
    from job_sheet
    where delivery_date >= @a
      and delivery_date <= date_add(@a, interval 21 day)
    

    See SQL Fiddle with Demo

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

Sidebar

Related Questions

I have a scenario where i need to synchronize two tables in SSIS Table
I have a scenario where I need to show a different page to a
I have a scenario where I need to pull approximately 7500 database records where
I have a scenario where I need to show the preview of form in
I have a scenario where I need to pull the title from a img
I have scenario where I need to host a web service (WCF) on Azure
I have one scenario where I need to select all files having aliencoders.numeric-digits like
I have a scenario where I need to load properties from database or java
I have a scenario where I need to do the following in a transaction:
I have a scenario where I need to search from many binary files (using

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.