我有一个start_date
和end_date
。我想获取这两个日期之间的日期列表。谁能帮助我指出查询中的错误。
select Date,TotalAllowance
from Calculation
where EmployeeId=1
and Date between 2011/02/25 and 2011/02/27
这Date
是一个datetime
变量。
您应该将这两个日期放在单引号之间,例如。
select Date, TotalAllowance from Calculation where EmployeeId = 1
and Date between '2011/02/25' and '2011/02/27'
或可以使用
select Date, TotalAllowance from Calculation where EmployeeId = 1
and Date >= '2011/02/25' and Date <= '2011/02/27'
请记住,第一个日期是包含日期,但第二个日期是排除日期,因为它实际上是“ 2011/02/27 00:00:00”
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句