I want to filter data from SQL Server 2008 R2 using FromDate and ToDate with another 2 user input dates. I want query for that.
I want to filter data such a way that If user input 2 dates or any date in between of them lies in FromDate or 'ToDate' or in between date then it filters data.
For i.e.
FromDate ToDate
15-11-2014 20-11-2014
if user input dates are 11-11-2014 and 20-12-2014. It means in between dates of this 2 dates lies in between FromDate and ToDate so it should return this record.
Now, if user input dates are 11-11-2014 and 14-11-2014. It means in between dates of this 2 dates does not lie in between FromDate and ToDate so it should not return this record.
It must match given dates and as well as in between dates.