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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:53:56+00:00 2026-06-09T06:53:56+00:00

Apologies on the question title I’m having a hard time articulating this. It’s much

  • 0

Apologies on the question title I’m having a hard time articulating this. It’s much easier via example:

I have a table with two date fields; start_date and end_date. Dummy data:

+----+------------+------------+
| id | start_date | end_date   |
+----+------------+------------+
| 1  | 2012-01-10 | 2012-04-13 |
| 2  | 2012-02-09 | 2012-05-12 |
| 3  | 2012-03-08 | 2012-06-11 |
| 4  | 2012-04-07 | 2012-07-10 |
| 5  | 2012-05-06 | 2012-08-09 |
+----+------------+------------+

So now I have a given month, let’s say March 2012. Is there a way to see if March 2012 falls within start_date and end_date for id 2? How about 3 (3 is a bit different as parts of March 2012 fall between start_date and end_date which is fine, we don’t need the whole month, parts are fine)?

I’ve been sitting here trying to think of how to write a query and am completely stumped

  • 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-09T06:53:58+00:00Added an answer on June 9, 2026 at 6:53 am

    If you can use the exact month range (i.e. give exact day of start end day) then such query should work fine:

    SELECT id FROM MyTable 
    WHERE start_date <= '2012-03-31' 
    AND end_date >= '2012-03-01' 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, my apologies for the title of this question, I don't have
Apologies for the poor question title. I have two tables, jobs and Persons-Jobs. Jobs
(Apologies for the title of this question - I wasn't overly sure how to
As the title says, I'm using SQL Server 2008. Apologies if this question is
Apologies for the very broadly title question. Basically this follows on from my earlier
Apologies for the unweildy title, this is a very difficult question to put into
First of all, apologies for the title of this question, but i couldn't come
Apologies in advance, because I suspect this may be a silly question. I have
I could not think of a better way to title this question. my apologies
Apologies for the title, I found it hard to define my question succintly and

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.