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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:21:04+00:00 2026-05-24T16:21:04+00:00

I have a table with three fields, namely id (Primary Key), start_date (Date) and

  • 0

I have a table with three fields, namely id (Primary Key), start_date (Date) and no_of_days (Int). I need to fetch the results from this table in such a way that after adding no_of_days days to start_date the resultant date should be less than the current date.

For example, if we have this row in table

id     start_date    no_of_days
8      2011-08-19       10  

If we add 10 (no_of_days) to 2011-08-19 (start_date) then the resultant date will be 2011-08-29 and it is also less than current date so this entry should be fetched.

How can I do this using a MySQL query?

  • 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-24T16:21:04+00:00Added an answer on May 24, 2026 at 4:21 pm
    SELECT
      *
    FROM
      table
    WHERE
      start_date + INTERVAL no_of_days DAY < CURRENT_DATE
    

    Or even better, an equivalent query which can use an index on the start_date column by rearranging:

    SELECT
      *
    FROM
      table
    WHERE
      start_date < CURRENT_DATE - INTERVAL no_of_days DAY
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a (simplified) table consisting of three columns: id INT PRIMARY KEY NOT
I have a table with three fields, one an identity field, and I need
I need to get three fields from a table. The table has the fields
I have a table with fields id (primary key), name1, name2, and nicknames. Given
I have a table Fixture with three fields. ID | Fixture | Date -------------------------
I have a table called Follow , with three fields: Id (autoincrement int), UserId
I have a table with three fields (ID, Price, Date) in excel. It has
I have a table with three fields, FirstName, LastName and Email. Here's some dummy
I have a table with three fields, User , City and Country , where
I have a table with three columns: user varchar, status varchar , rep int

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.