0

Hi i try to display dates between two dates(i don't have any table ) using mysql. simply i have two dates 2013-10-01 and 2013-10-05 but i did't success

;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

i think this works on only sqlserver not in mysql

i want output like

2013-10-01
2013-10-02
2013-10-03
2013-10-04
2013-10-05
Community
  • 1
  • 1

0 Answers0