写SQL语句的问题,怎么判断字段里的日期是否为今天?

haoya1 2007-11-17 11:28:04
我是想获取今天创建的记录数,请问这个SQL语句怎么写?


是用access数据库
SELECT COUNT(0) FROM Table WHERE CreateTime = now();
...全文
975 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
wyw1997 2007-11-19
  • 打赏
  • 举报
回复
select * from table where createtime=DateTime.Now.Date;
rj051lican 2007-11-17
  • 打赏
  • 举报
回复
select count(*) from table where CreateTime=getdate()
haoya1 2007-11-17
  • 打赏
  • 举报
回复
谢谢,Koala_sea的可行
vicqqq 2007-11-17
  • 打赏
  • 举报
回复
select count(0) from table where CreateTime >= Convert(char(10),getdate(),120) and
CreateTime<Convert(char(10),getdate()+1,120)
haoya1 2007-11-17
  • 打赏
  • 举报
回复
今天是系统时间,不是固定的#2007-11-17#
Koala_sea 2007-11-17
  • 打赏
  • 举报
回复
那个CreateTime如果有时间的话。可以格式化下用format(CreateTime,'yyyy-mm-dd')
洋溢2016 2007-11-17
  • 打赏
  • 举报
回复
o
Koala_sea 2007-11-17
  • 打赏
  • 举报
回复
SELECT COUNT(0) FROM Table WHERE CreateTime = #2007-11-17#

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧