其中,table_name
是要查询的表名,date_column
是日期字段的列名。
一周
SELECT
*
FROM
table_name
WHERE
date_column BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 WEEK) AND CURDATE();
一个月
SELECT
*
FROM
table_name
WHERE
date_column BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 MONTH) AND CURDATE();
标签:name,column,查询,CURDATE,MYSQL,date,table,范围
From: https://www.cnblogs.com/star926/p/17516629.html