编号    姓名    科目             时间              分数1 张三 英语 2010-01-20 09:53:29.250     88
2 张三 语文 2010-01-10 09:54:35.000     90
3 张三 数学 2010-01-20 09:54:34.763     68
4 李四 英语 2010-01-20 09:54:47.937     88
5 李四 语文 2010-01-19 09:54:54.000     90
6 小六 数学 2010-01-20 09:54:58.467     69
7 张三 英语 2010-01-20 09:53:29.250     88
8 张三 语文 2010-01-10 09:54:35.000     90
9 张三 数学 2010-01-20 09:54:34.763     68
10 李四 英语 2010-01-20 09:54:47.937     88
11 李四 语文 2010-01-19 09:54:54.000     90
12 小六 数学 2010-01-20 09:54:58.467     69
13 李四 数学 2010-01-18 09:55:03.000     68
14 小六 语文 2010-01-19 09:55:03.000     50这种时间带毫秒的怎么查询(每页2条显示)

解决方案 »

  1.   

    SELECT * from 表名 where datepart('yyyy',时间字段名 )='2010' and datepart('m',时间字段名)='01' and datepart('d',时间字段名)='19'
      

  2.   

    变量=接收到要查询的日期
    select * from table where datediff(yyyy,时间字段,变量)=0 and datediff(MM,时间字段,变量)=0 and datediff(dd,时间字段,变量)=0 
      

  3.   


    select * from table where  convert(varchar(20), 时间 ,120)='2010-01-19'
      

  4.   

    效率高点:
    declare @begindate datetime
    declare @endDate datetime
    set @begindate=convert(char(10),getdate(),120)
    set @endDate=convert(char(10),getdate(),120)+' 23:59:59'select * from tb
    where 时间 between @begindate and @endDate
      

  5.   

    这个容易,也可以用 字段.SUBSTRING ( expression, start, length )