SET @beginDate='2017-07-10'; SET @maxDate ='2017-07-31'; SELECT DATE(@tempDay) AS DATE,@tempDay:=DATE_ADD(@tempDay,INTERVAL 1 DAY) FROM 表名 f LEFT JOIN (SELECT @tempDay:=@beginDate) b ON 1=1 WHERE @tempDay<=@maxDate
SET @beginDate='2017-07-10'; SET @maxDate ='2017-07-31'; SELECT DATE(@tempDay) AS DATE,@tempDay:=DATE_ADD(@tempDay,INTERVAL 1 DAY) FROM 表名 f LEFT JOIN (SELECT @tempDay:=@beginDate) b ON 1=1 WHERE @tempDay<=@maxDate