(MySQL)如何得到Date Range之間的所有日子

WITH
cte_name [(col1, col2, ...)]
AS ( subquery )
Select col1, col2, .. from cte_name;
WITH RECURSIVE
cte_name [(col1, col2, ...)]
AS
(
Selet a, b, ... n from table_name
UNION ALL
Select col1, col2, ...coln from cte_name
WHERE terminating condition
)
Select col1, col2, .. from cte_name;
set @start_date := '2022-01-01';
SET @end_date := '2022-01-05';

WITH RECURSIVE
DateRange(DateData) AS
(
SELECT @start_date
UNION ALL
SELECT DATE_ADD(DateData, INTERVAL 1 DAY) FROM DateRange WHERE DateData < @end_date
)
SELECT DateData FROM DateRange;

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store