mysql查询本月、本周、今日、昨日数据
created_at 类型为 timestamp
-- SELECT COUNT(1) FROM lara_orders WHERE MONTHNAME(created_at)=MONTHNAME(NOW())
-- SELECT COUNT(*) FROM lara_orders WHERE WEEK(created_at)=WEEK(NOW())
-- SELECT COUNT(1) FROM lara_orders WHERE DATE_FORMAT(created_at, "%Y-%m-%d")=CURDATE()
-- SELECT COUNT(*) FROM lara_orders WHERE DATE_FORMAT(created_at,"%Y-%m-%d")=DATE_ADD(CURDATE(),INTERVAL "-1" DAY)
以上是 mysql查询本月、本周、今日、昨日数据 的全部内容, 来源链接: utcz.com/z/534902.html