我有一周中所有日子的数据,我想查找最近工作日的数据,即dayofweek != 1 and dayofweek != 7
我笨拙的 WHERE with CASE 类似于
WHERE CASE WHEN dayofweek(curdate()) = 1 THEN day(time) = date_sub(day(time), interval 2 day)
WHEN dayofweek(curdate()) = 7 THEN day(time) = date_sub(day(time), interval 1 day)
WHEN dayofweek(curdate()) != 7 AND dayofweek(curdate()) != 1 THEN day(time) = day(curdate()) ELSE 1 = 1 END