标签: mysql
如何限制我的SQL仅包含本周的数据? (星期一到星期日)
想到:
SELECT * FROM log WHERE timestamp >= timestamp - INTERVAL 7 DAY && DAYOFWEEK(timestamp-INTERVAL 7 DAY) > 2
但有些事情不对......
答案 0 :(得分:1)
SELECT * FROM log WHERE yearweek(curdate()) = yearweek(timestamp)
YEARWEEK