嘿伙计们,我有一个 mysql 表,其中包含一些记录,如下图所示!
我有以下查询来计算指定时间范围内的记录数(sr13、r4 和华为的记录数)。
$date1 = "2012-01-02 03";
$date2 = "2014-12-30 24";
$counter_result = $this->db->query("select count(sr13) as count_sr13, count(r4) as count_r4, count(huawei) as count_huawei from cdrcount where date_time BETWEEN '$date1%' and '$date2%' ");
查询将三个字段的值返回为 0。查询有什么问题吗?