K
kohai
Hi,
Any help out there that the masters can shed some light on would be greatly
appreciated.
I have tables where data is stored based on different frequencies(Daily,
Weekly, Monthly). The primary keys are the Date and the Company ID.
What I am trying to figure out is whether there is any way to pull data from
a table of greater date frequency and have the data from the table with less
frequency such that the table with less frequency will repeat its value until
its next point in time.
I know that joins would bring back only where the values are equal and I
don't want to have to store the data of shorter frequency on a more frequent
basis since it will be repeating and violate cardinal rule of db design.
For Example:
More frequent:
1/5/05 ABC 5.25
1/5/05 DEF 2.41
1/5/05 XYZ 9.82
1/12/05 ABC 4.22
1/12/05 DEF 3.12
1/12/05 XYZ 8.88
.....
2/1/05 ABC 4.25
2/1/05 DEF 6.41
2/1/05 XYZ 10.82
2/8/05 ABC 7.22
2/8/05 DEF 1.12
2/8/05 XYZ 9.99
Less Frequent:
12/31/04 ABC 52.5
12/31/04 DEF 31.9
12/31/04 XYZ 44.4
1/31/05 ABC 50.5
1/31/05 DEF 30.9
1/31/05 XYZ 49.4
My goal would be to have the weekly data point divided by the most recent
month end point for each week.
1/5 05 ABC 5.25 / 52.5
1/5/05 DEF 2.41 / 31.9
1/12/05 ABC 4.25 / 52.5
1/12/05 DEF 3.12 / 31.9
2/1/05 ABC 4.25 / 50.5
2/1/05 DEF 6.41 / 30.9
2/8/05 ABC 7.22 / 50.5
etc.........
Is something like this feasable with some type of subquery? Do I need a
table where these repeating dates are set up?
Your help is greatly appreciated.
Thank you.
kohai
Any help out there that the masters can shed some light on would be greatly
appreciated.
I have tables where data is stored based on different frequencies(Daily,
Weekly, Monthly). The primary keys are the Date and the Company ID.
What I am trying to figure out is whether there is any way to pull data from
a table of greater date frequency and have the data from the table with less
frequency such that the table with less frequency will repeat its value until
its next point in time.
I know that joins would bring back only where the values are equal and I
don't want to have to store the data of shorter frequency on a more frequent
basis since it will be repeating and violate cardinal rule of db design.
For Example:
More frequent:
1/5/05 ABC 5.25
1/5/05 DEF 2.41
1/5/05 XYZ 9.82
1/12/05 ABC 4.22
1/12/05 DEF 3.12
1/12/05 XYZ 8.88
.....
2/1/05 ABC 4.25
2/1/05 DEF 6.41
2/1/05 XYZ 10.82
2/8/05 ABC 7.22
2/8/05 DEF 1.12
2/8/05 XYZ 9.99
Less Frequent:
12/31/04 ABC 52.5
12/31/04 DEF 31.9
12/31/04 XYZ 44.4
1/31/05 ABC 50.5
1/31/05 DEF 30.9
1/31/05 XYZ 49.4
My goal would be to have the weekly data point divided by the most recent
month end point for each week.
1/5 05 ABC 5.25 / 52.5
1/5/05 DEF 2.41 / 31.9
1/12/05 ABC 4.25 / 52.5
1/12/05 DEF 3.12 / 31.9
2/1/05 ABC 4.25 / 50.5
2/1/05 DEF 6.41 / 30.9
2/8/05 ABC 7.22 / 50.5
etc.........
Is something like this feasable with some type of subquery? Do I need a
table where these repeating dates are set up?
Your help is greatly appreciated.
Thank you.
kohai