我有一个表是这样的记录之间..选择两个日期
TeacherName | Class | Section | SubjectId | Date | ToDate |Day
--------------------------------------------------------------------------------
Matt | 12 | B | Math |2013-03-04 |2013-03-14 |Mon
John | 12 | A | Phy |2013-04-03 |2013-04-12 |Mon
我想查询是这样的(而不是实际的SQL查询)...
Select *
from Table
where Class='12' and section='B' and Date= '2013-03-07'
这应该给我第一行有Matt
,因为给定日期2013-03-07
位于该行的日期范围内,从2013-03-04
到2013-03-14
。
这甚至可能吗?
你有没有真正尝试过吗? – 2013-03-04 08:15:49
我用关键字之间,但不会在这种情况下工作。 – Arbaaz 2013-03-04 08:16:23
Select * from Table where class = '12'and section ='B'and Date ='2013-03-07' does not return anything – Arbaaz 2013-03-04 08:17:43