有个表里有个字段为addtime,精确到秒,就是检索出24小时之内的信息。

解决方案 »

  1.   

     datediff(day,addtime,getdate())=0
      

  2.   

    select * from tb where datediff(ss,addtime,getdate())>=24*60*60
      

  3.   

    不行啊。怪我没说清楚。
    select count(ID) as num2 from test where Article_Id="&id&" order by ???
    ----
    是这个语句怎么判断addtime为24小时内的数据啊。
      

  4.   

    select * from tb where datediff(ss,addtime,getdate())>=24*60*60
      

  5.   

    select count(ID) as num2 from test where Article_Id="&id&"  
    and addtime between DATEADD(day,-1,getdate()) and GETDATE()
    order by ??? 
      

  6.   


    Select GETDATE(),DATEADD(day,-1,getdate()) 
    /*
                            
    ----------------------- -----------------------
    2009-11-04 11:21:53.030 2009-11-03 11:21:53.030(1 行受影响)*/