mysql 获取时间段 所有日期

发布时间 2023-09-19 16:18:19作者: 林财钦
点击查看代码
select date_add('2020-01-20 00:00:00', interval row DAY) date from
(
SELECT @row := @row + 1 as row FROM
(select 0 union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) t,
(select 0 union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) t2,
(SELECT @row:=-1) r
) se
where date_add('2020-01-20 00:00:00', interval row DAY) <= '2020-03-02 00:00:00'

image