first time poster long time reader. I was wondering if anyone know how to create a Temporary Table that generates a list of dates. Basically what I need this table for is so i can add 1 to each date which is between two other dates from a record. I keep getting errors in mySQL so i was hoping someone could correct me if you see a mistake.
set @start_date = ‘2014-07-29’;
set @end_date = ‘2016-07-29’;
CREATE TEMPORARY TABLE Dates (
d DATE,
PRIMARY KEY (d))
WHILE (@start_date < @end_date)
BEGIN
INSERT INTO Dates (d) VALUES (@start_date)
SELECT @start_date = DATEADD(DAY, 1, @start_date)