你只要计算周末,不管中国的节假日?
select t.mydate from (
SELECT
DATE_FORMAT(
DATE_ADD(
CONCAT('2023-06-01'),
INTERVAL (CAST(help_topic_id AS SIGNED)) DAY
),
'%Y-%m-%d'
) myDATE,
case when weekday(DATE_FORMAT(
DATE_ADD(
CONCAT('2023-06-01'),
INTERVAL (CAST(help_topic_id AS SIGNED)) DAY
),
'%Y-%m-%d'
)) in(5,6) then 0 else 1 end as 是否需要/*返回为0的就是周末,不需要的*/
FROM
mysql.help_topic
WHERE help_topic_id < TIMESTAMPDIFF(
DAY,
CONCAT(
STR_TO_DATE('2023-06-01', '%Y-%m-%d')
),
CONCAT(
STR_TO_DATE('2023-07-05', '%Y-%m-%d')
)
)
) t
where 是否需要=1