0
如何限制我的SQL僅包含本週的數據? (週一至週日)選擇本週日期的數據?
思想:
SELECT * FROM log WHERE timestamp >= timestamp - INTERVAL 7 DAY && DAYOFWEEK(timestamp-INTERVAL 7 DAY) > 2
但有些事情是不正確的......
如何限制我的SQL僅包含本週的數據? (週一至週日)選擇本週日期的數據?
思想:
SELECT * FROM log WHERE timestamp >= timestamp - INTERVAL 7 DAY && DAYOFWEEK(timestamp-INTERVAL 7 DAY) > 2
但有些事情是不正確的......
SELECT * FROM log
WHERE yearweek(curdate()) = yearweek(timestamp)