Hi,
On this link they explain how to insert date rows to a table, and it looks like it works perfect, the only thing it inserts until year 2042 and I dont want that many, suppose that can be changed in the script.
But at the moment what I am trying to do is at the same time when I insert the daterows I want to insert other information belonging to those dates.
This is the link:
[
brianshowalter.com...]
First I created the table with the columns: property, price, description and dt.
Then I created another table to calculate the dates:
CREATE TABLE ints ( i tinyint );
INSERT INTO ints VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
And then I am supposed to do this:
INSERT INTO calendar_table (dt)
SELECT date('2010-01-01') + interval a.i*10000 + b.i*1000 + c.i*100 + d.i*10 + e.i day
FROM ints a JOIN ints b JOIN ints c JOIN ints d JOIN ints e
WHERE (a.i*10000 + b.i*1000 + c.i*100 + d.i*10 + e.i) <= 11322
ORDER BY 1;
However as I said I want to add: property, price and description and the dates at the same time.
Been trying several ways in phpmyadmin but get the error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2010-01-01') + interval a.i*10000 + b.i*1000 + c.i*100 + d.i*10 + e.i day FROM i' at line 2
trying to do this:
INSERT INTO calendar_table (property, price, description, dt)
values ('Casa_Blanca_4', '85', 'easter', 'SELECT date('2010-01-01') + interval a.i*10000 + b.i*1000 + c.i*100 + d.i*10 + e.i day
FROM ints a JOIN ints b JOIN ints c JOIN ints d JOIN ints e
WHERE (a.i*10000 + b.i*1000 + c.i*100 + d.i*10 + e.i) <= 11322)'
ORDER BY 1;
Is it posible to do what I am trying to do?
and I suppose changing the numbers 10000 etc I will get less dates.
Thanks,
Helen