比如:
select count(BrowserType) as AllCount from SiteAnalyse where SiteItem='Home' and where RecordTime between '#00-01-01 01:00:00#' and '#00-11-01 01:59:59#'
这样写对不对?
大家说说看!因为时间中间有空格,所以很麻烦!
...全文
40513打赏收藏
谁能解决SQL语句时间比较的写法!
比如: select count(BrowserType) as AllCount from SiteAnalyse where SiteItem='Home' and where RecordTime between '#00-01-01 01:00:00#' and '#00-11-01 01:59:59#' 这样写对不对? 大家说说看!因为时间中间有空格,所以很麻烦!
这样试试看:
SELECT COUNT(BrowserType) AS AllCount FROM SiteAnalyse WHERE SiteItem='Home' AND RecordTime BETWEEN #"00-01-01 01:00:00"# AND #"00-11-01 01:59:59"#
或者:
SELECT COUNT(BrowserType) AS AllCount FROM SiteAnalyse WHERE SiteItem='Home' AND RecordTime BETWEEN #"&00-01-01 01:00:00&"# AND #"&00-11-01 01:59:59&"#
因很久没用asp了,所以不太记得了。
在php里面可以先取得某一时间的时间戳记,通过时间戳记来比较,在asp里面我就不清楚了,可以试试看!
SELECT COUNT(BrowserType) AS AllCount FROM SiteAnalyse WHERE SiteItem='Home' AND RecordTime BETWEEN #00-01-01 01:00:00# AND #00-11-01 01:59:59#
试一试,看看行不行?
select count(BrowserType) as AllCount from SiteAnalyse where SiteItem='Home' and where RecordTime between '2000-01-01 01:00:00' and '2000-11-01 01:59:59'