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 
posted @ 2021-06-02 11:16  TBHacker  阅读(6351)  评论(0编辑  收藏  举报