MySQL查询两个日期/时间之间记录的两种方法

admin 阅读:77 2024-03-03

一,使用>和<符号查询:

select * from table where create_date<'2017-05-31' and create_date>'2017-01-01';

二,使用between查询:

select * from table where create_date between '2017-01-01' and '2017-05-31'

注意:如果create_date是时间戳类型,那么日期换成时间戳即可。

声明

1、部分文章来源于网络,仅作为参考。
2、如果网站中图片和文字侵犯了您的版权,请联系1943759704@qq.com处理!