At 12:59 PM 10/10/2003, you wrote:
I want know if there is a way to return every date between 2 date ranges
regardless if there is a row in a table.  I have a table that contains
daily pricing information and I want to be able to do a mass
updated/insert records.  I know how to write the updates/inserts if I
have table that contains EVERY date between the date ranges, but I don't
want to keep a table around that has one row for every possible date.

I can't use the replace into command because of a foreign keys on the
table.

The insert will look something like this

Insert into daily_rate from
   select date,123.45
   from allpossibledates
   left join daily_rate on allpossibledates.date=daily_rate.date
   where date between 20030901 and 20031010
        and daily_rate.date is null

The problem is I don't know how to generate allpossibledates easily on
the fly.

I am running 3.23.58 and can't upgrade to the latest versions yet due to
incompatibilties with the timestamp formats that were changed.

TIA

Ross

Ross, This should get you started:

set @n=0;
select date_add(CurDate(), INTERVAL (@n := @n + 1) DAY), col1 from table1;

Mike



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to