sql如何查询当天数据? 有个表里有个字段为addtime,精确到秒,就是检索出24小时之内的信息。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 datediff(day,addtime,getdate())=0 select * from tb where datediff(ss,addtime,getdate())>=24*60*60 不行啊。怪我没说清楚。select count(ID) as num2 from test where Article_Id="&id&" order by ???----是这个语句怎么判断addtime为24小时内的数据啊。 select * from tb where datediff(ss,addtime,getdate())>=24*60*60 select count(ID) as num2 from test where Article_Id="&id&" and addtime between DATEADD(day,-1,getdate()) and GETDATE()order by ??? Select GETDATE(),DATEADD(day,-1,getdate()) /* ----------------------- -----------------------2009-11-04 11:21:53.030 2009-11-03 11:21:53.030(1 行受影响)*/ SQL Server的导入导出 求SQL Server考试70-450资料 数据匹配问题 达人帮我,我急死了,谢谢大家了,谢谢了,在线等 SQL Server 2005 Reporting Services 的关于父子维度展示问题的解决方案浅析 SQL查询帮助~~~~ 远程过程调用失败。[0x800706be] 从中间取出连续的记录 紧急!简单的登录ORACLE ENTERPRISE MANAGER的问题 从一个数据库A到另一个数据库B 复制数据的问题 sql server的维护计划无法使用 关于update和insert的问题,求助!
select count(ID) as num2 from test where Article_Id="&id&" order by ???
----
是这个语句怎么判断addtime为24小时内的数据啊。
and addtime between DATEADD(day,-1,getdate()) and GETDATE()
order by ???
Select GETDATE(),DATEADD(day,-1,getdate())
/*
----------------------- -----------------------
2009-11-04 11:21:53.030 2009-11-03 11:21:53.030(1 行受影响)*/