您好我尝试使用mysql显示两个日期之间的日期(我没有任何表格)。 我只有两个日期2013-10-01和2013-10-05,但我没有成功
;WITH cte AS (
SELECT CASE WHEN DATEPART(Day,@StartDate) = 1 THEN @StartDate
ELSE DATEADD(Month,DATEDIFF(Month,0,@StartDate)+1,0) END AS myDate
UNION ALL
SELECT DATEADD(Month,1,myDate)
FROM cte
WHERE DATEADD(Month,1,myDate) <= @EndDate
)
SELECT myDate
FROM cte
OPTION (MAXRECURSION 0)
Easiest way to populate a temp table with dates between and including 2 date parameters
我认为这只适用于不在mysql中的sqlserver
我想输出
2013-10-01
2013-10-02
2013-10-03
2013-10-04
2013-10-05