乐考网靠谱吗:access 时间段查询

来源:百度文库 编辑:神马品牌网 时间:2024/05/04 23:52:04
给高手们出一个难题,呵呵
说在Access库里查询2006-6-11日的20:00:00----2006-06-12日的8:00:00
之间的所有内容就是select * from mytable where ...
日期字段是dateCol时间字段是timeCol
怎么写
select * from mytable where dateCol>=#2006-6-11# and dateCol<=#2006-6-12# and timeCol>=#20:00:00# and timeCol<=#8:00:00#
我是这样写的,但是不对,不知道怎么写了,帮忙解决一下
谢谢两位的答复,我们不妨比较一下,这样也是一种答案,
select * from mytable where dateCol+timeCol
between '2006-06-13 20;00:00' and '2006-06-14 8:00:00'

select * from mytable where (dateCol=#2006-6-11# and timeCol>=#20:00:00#) or (dateCol=#2006-6-12# and timeCol<=#8:00:00# ) or (dateCol>#2006-6-11# and dateCol<#2006-6-12#)

写完整的长日期就行了
select * from mytable where dateCol>=#2006-6-11 20:00:00# and dateCol<=#2006-6-12 8:00:00#