select * from news where shijian = '2001-2-21'

解决方案 »

  1.   

    为什么不这样用?
    select * from news where shijian>='2001-2-20' and shijian<='2002-2-22'select * from news where shijian between '2001-2-20' and '2002-2-22'
      

  2.   

    shijian 是datetime类型?
    select * from news where convert(varchar(20),shijian,120)='2001-02-21 09:21'
      

  3.   

    select * from news where convert(varchar(20),shijian,120) like '2001-02-21 09:21%'
      

  4.   

    那就shijian > '2001-2-20 0:00'
      

  5.   

    取出今天提交的数据,也就是00:00---24:00
    select * from news where convert(varchar(10),shijian,120)='2001-02-21'
      

  6.   

    也可以
    select * from news where datediff(day,'2001-02-21',shijian)=0
      

  7.   

    where shijian>='2001-02-01' and shijian<'2001-02-02'
    or
    where shijian>='2001-02-01' and shijian<='2001-02-01 23:59:59.999'