我的数据库里的表是每分钟采的数,我现在想用VB取数据库中时间为5分钟,10分钟这样的数,也就是每5分钟一个,
比如:2009-03-22 5时 到 2009-03-25 2时 这个时间段的 每5分钟取个数
即2009-03-22 05:00:00
2009-03-22 05:05:00
2009-03-22 05:10:00
......
......
2009-03-25 02:00:00请写出VB查询的代码 ,谢谢
比如:2009-03-22 5时 到 2009-03-25 2时 这个时间段的 每5分钟取个数
即2009-03-22 05:00:00
2009-03-22 05:05:00
2009-03-22 05:10:00
......
......
2009-03-25 02:00:00请写出VB查询的代码 ,谢谢
from mytable
where right(myfield,2)='00'
and (mid(myfield,16,1)='0' or mid(myfield,16,1)='5')
from mytable
where right(myfield,2)='00'
and (substring(myfield,16,1)='0' or substring(myfield,16,1)='5')
dim tmBeg as date
dim tmEnd as date
tmbeg=#2009-2-22 8:03:33#
tmend=#2008-9-25 8:03:33#'固定死时间的写法
select * from testdb.dbo.timetest where (right(datepart(minute,tmDate)-3,1)=5 or right(datepart(minute,tmDate)-3,1)=0) and tmdate>='2009-2-22 8:03:33'and tmdate <='2008-9-25 8:03:33''用参数的写法
select * from testdb.dbo.timetest where (right(datepart(minute,tmDate)-3,1)=5 or right(datepart(minute,tmDate)-3,1)=0) and tmdate>='"& tmbeg &"'and tmdate <='"& tmEnd &"'"
--给定的开始时间为starDate
--给定的结束时间为endDate
--在指定时间内的时间和开始时间相减为5的整数陪时就是select *
from mytable
where tmpdate between stardate and enddate
and datediff(d,stardate,tmpdate) % 5=0