6,108
社区成员




请大佬帮忙看看这段有什么问题:求本年度所有日期(t1是只含id=1的表),运行后只显示ok,没有内容
with recursive cte as
(select concat(year(now()),'-1-1') dy from t1
union all
select date_add(dy, interval 1 day) from cte
where year(dy) = year(now()))
select * from cte;
知道原因了,种子查询格式的问题,奇怪也不报错:
with recursive cte as
(select date_add(concat(year(now()),'-1-1'), interval 0 day) dy from t1
union all
select date_add(dy, interval 1 day) from cte
where year(dy) = year(now()))
select * from cte;