程序员的出路

alex.w的Blog

导航

sql 语句对于两个时间段的查询写法

Posted on 2009-01-14 16:06  alex.w  阅读(1515)  评论(0)    收藏  举报

 ACCESS的话
select * from table where date1<#2008-1-20# and date2>#2007-8-30#

MYSQL的话
select * from table where date1<'2008-1-20' and date2>'2007-3-30'
也可以
select * from table where date1 between '2008-1-20' and '2007-3-30'

其中date1,date2都是日期类型的字段