【发布时间】:2012-12-24 03:58:26
【问题描述】:
我们有像
这样的表结构id | startDay | startMonth | startYear | endDay | endMonth | endYear
1 | 22 | 12 | 2012 | 25 | 1 | 2013
现在我们有了另一个日期范围,例如 startDate,startMonth, startYear 即 25|12|2012 和 endDay,endMonth,endYear 即 10|1|2013。
我希望查询从表中提供的日期范围存在的表中获取记录。在这种情况下表示首先记录。
如何为此编写查询?
【问题讨论】:
-
为什么不使用
date类型作为开始和结束日期的日期字段?这就是这种类型的用途 - 处理mysql中的日期。 -
@Nemoden 实际上这个表结构已经设计好了,所以我们现在不能改变结构。