例如,表里有一列为时间列,现在要取2008-6-5到2008-6-10号的全部内容(有六条记录),
 select * from table where 时间列 between '2008-6-5'and '2008-6-10',但只能取出  2008-6-5日和2008-6-10日两条记录?请高手指教

解决方案 »

  1.   

    select * from table where 时间列 >= '2008-6-5'and 时间列 <='2008-6-10'试试
      

  2.   

    ms没问题
    可以尝试一下 日期>'2008-6-5 ' and 日期<'2008-6-10'
      

  3.   

    我刚才试了一下 用 pubs 数据表试的 用你的语句可以全取出来啊!
      

  4.   

    select * from table where 时间列 >= '2008-6-5 00:00:00' and 时间列 < '2008-6-11 00:00:00'你写的select * from table where 时间列 between '2008-6-5'and '2008-6-10'
    能查出'2008-6-5 00:00:00' 到'2008-6-10 00:00:00'的数据.
      

  5.   

    select * from table where datediff(day,'2008-6-5',时间列)  >= 0 AND datediff(day,'2008-06-10',时间列) <= 0