想查询一天添加了多少条数据。如 table1id  name  addtime其中,addtime 的格式为 2007-09-28 14:38:23.890

解决方案 »

  1.   

    select count(1) from tb where datediff(dd,addtime,getdate())=0
      

  2.   

    select convert(varchar(10),addtime,120),count(*)
    from tb
    group by convert(varchar(10),addtime,120)
      

  3.   

    select
     convert(varchar(10),addtime,120),count(1)
    from
     tb
    group by
     convert(varchar(10),addtime,120)
      

  4.   


    select
     convert(varchar(10),addtime,120),count(1)
    from
     tb
    where
     datediff(dd,addtime,getdate())>=0
    group by
     convert(varchar(10),addtime,120)
      

  5.   

    select count(1) from tb where datediff(dd,addtime,getdate())=0和select
     convert(varchar(10),addtime,120),count(1)
    from
     tb
    where
     datediff(dd,addtime,getdate())>=0
    group by
     convert(varchar(10),addtime,120)
    区别是??