WITH RECURSIVE date_series AS (
SELECT '2024-01-07 00:05:01' AS date
UNION ALL
SELECT ADDDATE(date, INTERVAL 1 DAY)
FROM date_series
WHERE date < '2024-06-07 00:05:01'
)
SELECT DATE_FORMAT(date, '%Y-%m-%d') AS formatted_date
FROM date_series
ORDER BY date
clickhouse中
select toDate(num) as dt from (
select arrayJoin(
range(
toUInt32(toDate('2024-03-15')),
toUInt32(addDays(toDate('2024-04-14'), 1))
)
) as num
from numbers(1)
) t