mysql timestamp如何比较大小,查询范围
if (($start_time = $this->input_data['start_time']) && ($end_time = $this->input_data['end_time'])) {
$where['create_time'] = [['gt',$start_time.' 00:00:00'],['lt',$end_time.' 23:59:59'],'and'];
}
对应的sql
SELECT * FROM `old_warning` WHERE ( `create_time` > '2021-05-25 00:00:00' AND `create_time` < '2021-05-26 23:59:59' ) AND `village_id` = 2 AND `status` = 1 ORDER BY id desc LIMIT 0,10