P
(PeteCresswell)
Got a table with Dates, Types, and Amounts.
Types are Longs like 1, 2, 3, 4.
Dates are.... well, dates.... as in "02/05/2007".
Call it Table_A
Sometimes the dates are contiguous for a given Type, other times
they are non-contiguous.
I want to create another table, call it Table_B with contiguous
dates for each Type where the Type/Amount from the preceding date
are cloned if there is no Table_A record for that Type/Date.
My kneejerk is to write procedural VBA code to loop through
Table_A, and do comparisons on curType/curDate vs
prvType/prvDate.
But I have to wonder if there is a faster/more efficient solution
using SQL.
Is SQL the Good-Right-And-Holy path here? Or is it procedural
code the appropriate tool?
Types are Longs like 1, 2, 3, 4.
Dates are.... well, dates.... as in "02/05/2007".
Call it Table_A
Sometimes the dates are contiguous for a given Type, other times
they are non-contiguous.
I want to create another table, call it Table_B with contiguous
dates for each Type where the Type/Amount from the preceding date
are cloned if there is no Table_A record for that Type/Date.
My kneejerk is to write procedural VBA code to loop through
Table_A, and do comparisons on curType/curDate vs
prvType/prvDate.
But I have to wonder if there is a faster/more efficient solution
using SQL.
Is SQL the Good-Right-And-Holy path here? Or is it procedural
code the appropriate tool?