MySQL—查询某时间范围的数据
– 查询今天的数据
select * from user where to_days(birthday) = to_days(CURDATE());
– 查询昨天的数据
select * from user where to_days(CURDATE()) - to_days(birthday)<=1;
– 查询最近7天的数据
select * from user where birthday > DATE_SUB(CURDATE(),INTERVAL 7 DAY);
– 查询最近一个季度的数据
转载
2022-03-04 14:34:34 ·
3661 阅读 ·
0 评论