July 10, 2013

to search whether a date is in between two date fields through my sql query

How to search whether a date is in between two date fields through my sql query




see the below table

----------------------------------------------------------
id | start_date    | end_date     | amount | status  | particular
-----------------------------------------------------------
1  | 12-02-2012 |13-07-2013  | 1729    | active  | Zulily
-----------------------------------------------------------
2  | 07-02-2014 |23-02-2014  | 1989   | active  | IOS 7
-----------------------------------------------------------
3  | 07-03-2014 |16-03-2014  | 1987    | active  | Windows 8.1
-----------------------------------------------------------
4  | 12-06-2014 |13-07-2014  | 1987    | active  | Ouya
-----------------------------------------------------------
5  | 12-10-2014 |28-11-2014  |2013    | active  | Comet C/2012
 -----------------------------------------------------------




 SQL query : select * from tbl_interest_rates where now() between start_date and  end_date;
Dated : 10 jully 2013

result  : 1  | 12-02-2012 |13-07-2013  | 1729    | active  | Zulily



This example will find whether the given date is inbetween dates in the given table.

+Shimjith Kumar
+Vipin Cp


http://belazy.blog.com/

Facebook comments