我已经表叫Master
,我需要所有匹配的日期的所有可能的记录按照用户输入@FromDate
和@Todate
....之间有两个日期条件
主表之间:
ID FromDate ToDate
1 18/03/2014 18/03/2014
2 01/03/2014 05/03/2014
3 06/03/2014 08/03/2014
我的查询:
select ID
from master M
where M.FromDate between('10/03/2014') and ('17/03/2014')
or M.ToDate between ('10/03/2014') and ('17/03/2014')
用户输入:
FromDate ToDate
01/03/2014 06/03/2014
01/03/2014 31/03/2014
09/03/2014 09/03/2014
预期输出:
2,3
1,2,3
No Records
没有条件是不正确的,我需要在查询所有条件的解决方案。 .. – Pradeep