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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:59:16+00:00 2026-06-17T16:59:16+00:00

Below is my mysql table: ————————– ID Date_From Date_To ————————– 1 2011-02-01 2011-02-28 2

  • 0

Below is my mysql table:

--------------------------
ID  Date_From   Date_To
--------------------------
1   2011-02-01  2011-02-28
2   2012-09-01  2012-09-30
3   2012-10-01  2012-10-30
4   2012-11-01  2012-11-30
5   2012-12-01  2012-12-30
6   2013-01-01  2013-01-30
7   2014-03-01  2014-03-31

I have this mysql statement:

SELECT *
FROM TIME_PERIOD
WHERE
  (YEAR(DATE_FROM) >= '2012' AND MONTH(DATE_FROM) >= '10')
  AND (YEAR(DATE_TO) <= '2013' AND MONTH(DATE_TO) <= '12');

which returns only the records with ID 3, 4, and 5. What Im expecting to return are records with ID 3, 4, 5, and 6.

Please help.

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

    You need to use query like this:

    SELECT * FROM TIME_PERIOD WHERE 
    (YEAR(DATE_FROM) >= '2013' OR (YEAR(DATE_FROM) >= '2012' AND
     MONTH(DATE_FROM) >= '10')) AND 
    (YEAR(DATE_TO) <= '2013' AND MONTH(DATE_TO) <= '12');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a MySQL table like this below: id | cat_id | name
the mysql table below has two columns. how do i select only those rows
I have mysql database structure like below: CREATE TABLE test ( id int(11) NOT
i have a table t_points in mySql like example in below. Name Surname Point
I have a mysql database with a table structure like below : Table Name
I have birth date data stored in Mysql table as below: id firstname middlename
In the code below, created is a field in a MySQL table. This field
How to return table name in the below mysql fulltext union search? (SELECT title,content,date
I have a mysql table called test, the structure code is given below CREATE
I have a mysql table in which one column named 'city' is like below

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.