要得到两个日期段之间的记录sql语句怎么写

解决方案 »

  1.   

    BETWEEN date1 AND date2
      

  2.   

    Where 时间字段 between 开始时间 and 结束时间
    --久闻 “于娜”大名,望常来坐坐  :)
      

  3.   

    select * from 表 where date>=date1 and date<=date1
      

  4.   

    select * from 表 where date>=date1 and date<=date2
      

  5.   

    听说  datediff 方式该怎么写?另外access数据库 中如何获取日期段的记录??
      

  6.   

    要得到两个日期段之间的记录sql语句怎么写------------------
    select * from 表 where date_tiem between date1 and date2
      

  7.   

    于娜啊,老相识了,一定要顶..............
    我觉得楼上的最好是要补充一下看日期类型,在mysql中通常要截取成标准日期"select * from tablename where subString(recorddate,1,10) between '"+date1+"' and '"+date2+"'"如果一个时间类型为"2007-06-02 000000000"这种的不取前几位可能会查不到结果,用between 
    "2007-06-02" and "2007-06-02" 只能查到刚好等于"2007-06-02 000000000"这条,其它的时间查不到.
      

  8.   

    interval = Microsoft.VisualBasic.DateDiff(DateInterval.Day, Time1, Time2)
      

  9.   

    不好意思,要提一下,上面的代码是在VB.NET中的。。