我想选择两个日期之间的数据,我按如下方式编写了查询:
SELECT *
FROM hospital_details
WHERE expirydate BETWEEN '03/13/2015' AND '03/18/2015'
但它也会显示03/17/2016
我该如何解决?
答案 0 :(得分:0)
您可以编写单一语法。
SELECT * FROM hospital_details WHERE ExpiryDate BETWEEN '$Date' AND '$b';
答案 1 :(得分:0)
活动记录,其中函数将采用关联数组;
$array = array('expirydate >= ' => $Date, 'expirydate <= ' => $b);
$this->db->where($array);
或客户字符串;
$where = "expirydate > ='$Date' AND expirydate < ='$b'";
$this->db->where($where);
显然,请确保您的变量格式正确 Active record docs here