sql语句是这样的:
$kstime=$_POST["kstime"];
$jstime=$_POST["jstime"];Select * From tab where createdtime >='".$kstime."' and createdtime <='".$jstime."'搜索出来的结果为什么不包括当天的呢?当createdtime >='2012-6-7' and createdtime <='2012-6-10'的时候,7号和10号的内容显示不出来,请各位帮忙!

解决方案 »

  1.   

    createdtime >='2012-6-7 00:00:00' and createdtime <='2012-6-10 23:59:59'如果直接判断2012-6-7这样的话得用in
      

  2.   


    #结果包含边界值
    $sql = "SELECT * FROM tab WHERE createdtime BETWEEN '".$kstime."' AND '".$jstime."';"
      

  3.   

    Select * From tab where createdtime BETWEEN '2012-06-28' and '2012-06-30'
    放到数据库里执行了一下,怎么还搜索不到呢?
      

  4.   

    createdtime 是什么类型。存储的格式是怎样的?
      

  5.   

    datetime类型的,格式是2012-06-08 09:44:58
      

  6.   

    Select * From tab where date_format(createdtime,'%Y-%m-%d') BETWEEN '2012-06-28' and '2012-06-30'