|
Posted by Ed Murphy on 08/21/06 06:49
On Sun, 20 Aug 2006 12:38:11 +0000 (UTC), Erland Sommarskog
<esquel@sommarskog.se> wrote:
>rcamarda (robc390@hotmail.com) writes:
>> I wish to build a table based on values from another table.
>> I need to populate a table between two dates from another table. Using
>> the START_DT and END_DT, create records between those dates.
>> I need a new column that is the days between the date and the MID_DT
>> The data I wish to end with would look something like this:
>>
>> PERIOD DATE DAY_NO
>> 200602 2005-07-06 -89
>> 200602 2005-07-07 -88
>> 200602 2005-07-08 -87
>><...>
>> 200602 2005-10-02 -2
>> 200602 2005-10-03 -1
>> 200602 2005-10-04 0
>> 200602 2005-10-05 1
>><...>
>> 200602 2005-12-18 75
[snip]
>> INSERT INTO tblDates VALUES('200602',2005-07-06,2005-10-03,2005-12-18)
>Anyway, as I said in another newsgroup, you need a table of numbers. Here
>is a way to create such a table with a million numbers:
What are the pros and cons of relying on such a table vs. using a
WHILE loop? Based on Rob's context of student registrations, let's
assume we're talking about a maximum of 300 iterations per row in
the original tblDates table.
[Back to original message]
|