日期的语法错误 在查询表达式 ✀datediff(✀d✀,tim,#2008-8-21 下午 09:39:17#)<1✀ 中。

2025-01-25 09:04:05
推荐回答(2个)
回答1:

可能是服务器的日期格式引起的
可以修改下日期时间格式
也可以把now()换成date()
sql="select top 4 username,count(username) from bbs_topic where datediff('d',time,#" & date() & "#)<1 group by username order by count(username) desc"

还可以试试这个(推荐使用)

sql="select top 4 username,count(username) from bbs_topic where datediff('d',time,date())<1 group by username order by count(username) desc"

回答2:

sql="select top 4 username,count(username) from bbs_topic where datediff('d',time,now())<1 group by username order by count(username) desc"
另外确保datediff中的time有效