Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends

I have a table that has two fields FromDate, and ToDate, and lots of data in it.
What I want is to get the rows If current month is midst of these fromdate and todate.

Eg:
(1) FromDate = 20/Dec/2013 & ToDate = 15/Feb/2014, So It should appear if Current Month (Jan 2014) is selected.
(2) If FromDate = 05/Jan/2014 & ToDate = 10/Jan/2014, This also should appear if current month is selected?

Can anybody give me a query that returns result like this ?

Thanks
Posted
Comments
Bala Selvanayagam 16-Jan-14 4:17am    
Where getdate() between FromDate and ToDate ?
Nicholas Marty 14-Feb-14 6:58am    
@Bala Selvanayagam: Please do NOT edit Spam questions.
Reason: http://www.codeproject.com/Messages/4462092/Live-streamers.aspx
Yesudasan Moses 16-Jan-14 4:20am    
Not for a single date,,,, a Month,,,

1 solution

Hi friends,

I found it last.,., It was so simple... Thanks all friends who replied me ...

SELECT * FROM RM_UserBookingData WHERE (FromDate< MAX_DATE_OF_THIS_MONTH) AND (ToDate> MIN_DATE_OF_THIS_MONTH)
 
Share this answer
 
Comments
Karthik_Mahalingam 16-Jan-14 4:25am    
good.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900