MySQL获取系统时间段

MySQL中如何用系统时间获取两年内的所有 周+1
注意!!不是查询表中的时间,是获取系统时间
例如:现在是2022年第24周,则 获得 202225,202224,202223一直到202025

with recursive cte(num,w) as (
    select 0 as num,yearweek(curdate()+interval 1 week) as w
    union all
    select num+1,(yearweek(curdate()-interval num week)) from cte where num<105
    )
select w from cte;

img

获取当前日期,你应该知道怎么写,给出你需要的核心函数

SELECT YEARWEEK('2022-06-18') from dual;

https://www.w3resource.com/mysql/date-and-time-functions/mysql-yearweek-function.php

学会查手册,这些不难的