当前位置:Gxlcms > 数据库问题 > MySQL 查询最近几天的记录 最近7天的记录 本周内的记录

MySQL 查询最近几天的记录 最近7天的记录 本周内的记录

时间:2021-07-01 10:21:17 帮助过:2人阅读

本周内:
select * from wap_content where week(created_at) = week(now)


查询一天:
select * from table where to_days(column_time) = to_days(now());select * from table where date(column_time) = curdate();


查询7天:
select * from table  where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(column_time);


查询一个月:
select * from table  where DATE_SUB(CURDATE(), INTERVAL INTERVAL 1 MONTH) <= date(column_time);

MySQL 查询最近几天的记录 最近7天的记录 本周内的记录

标签:

人气教程排行