WITH RECURSIVE T_TEMP_DATES AS (
SELECT '2022-11-07' AS DT
UNION
SELECT DATE_ADD(T_TEMP_DATES.DT, INTERVAL 1 DAY) FROM T_TEMP_DATES WHERE DATE_ADD(T_TEMP_DATES.DT, INTERVAL 1 DAY) <= '2022-11-10'
)
SELECT DT FROM T_TEMP_DATES;
포멧이 필요하면 아래!
WITH RECURSIVE T_TEMP_DATES AS (
SELECT DATE_FORMAT('20221103', '%Y%m%d') AS DT
UNION
SELECT DATE_FORMAT(DATE_ADD(T_TEMP_DATES.DT, INTERVAL 1 DAY), '%Y%m%d') FROM T_TEMP_DATES WHERE DATE_FORMAT(DATE_ADD(T_TEMP_DATES.DT, INTERVAL 1 DAY), '%Y%m%d') <= '20221111'
)
SELECT DT FROM T_TEMP_DATES;
;