MySQL Forums
Forum List  »  Newbie

Date SQL Query
Posted by: MuraliDharan V
Date: February 18, 2015 07:49AM

mysql> SELECT * FROM test_date;
+----+---------------------+---------------------+--------+
| id | from_date | to_date | status |
+----+---------------------+---------------------+--------+
| 1 | 1999-01-01 00:00:00 | 2000-01-01 00:00:00 | 1 |
| 2 | 2000-02-01 00:00:00 | 2002-01-01 00:00:00 | 1 |
| 3 | 2003-02-01 00:00:00 | 2005-01-01 00:00:00 | 1 |
+----+---------------------+---------------------+--------+
3 rows in set (0.01 sec)


This is my table, If my input is '2001-01-01', then i need to retrieve two records (id=1 and id=2) from my table.

How can i get it in a SQL Query.

Thanks,
Murali.V

Options: ReplyQuote


Subject
Written By
Posted
Date SQL Query
February 18, 2015 07:49AM
February 18, 2015 12:02PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.