0%

mysql查询最近的数据

DATE_SUB() 函数

DATE_SUB(date,INTERVAL expr type)
type 值
MICROSECOND
SECOND
MINUTE
HOUR
DAY
WEEK
MONTH
QUARTER
YEAR

示例

select * from xxx_table where create_time > DATE_SUB(NOW(),INTERVAL 1 HOUR);