我的数据库每个小时都会有新的数据被添加,如果我想按小时/天来用SQL语句自动统计新添加的记录数要怎么写才行呀,比如我要得到昨天每个小时新添加的记录的数量.求高手出手相助.

解决方案 »

  1.   

    select count(*) from 表名 where addtime>"指定时间" and addtime<"指定时间"
      

  2.   

    Select count(*) from 表 where addtime between "时间" and "时间"
      

  3.   


    declare @时间1 smalldatetimedeclare @时间2 smalldatetime
    set @时间1="2008-01-01"set @时间1="2008-01-02"Select count(*) from 表 where addtime between @时间1 and @时间2
      

  4.   

    使用的是access,好像不能用存储过程
      

  5.   

    上面的问题不用SQL查询来解决了 分多次用代码搞定 
    另问,access中要把字符型转换成整型用什么函数