Coding help please...

WSC

Registered User.
Local time
Yesterday, 19:06
Joined
Nov 16, 2006
Messages
19
I have 2 tables with data that need to be joined. One table has hourly information and another table has daily information. I need to have the table with daily information broken out into hourly information. For each date range i.e. 10/19/06 21:51 - 10/20/06 6:19, I need to have the minutes for each hour. All of this info needs to be put into a table. the date range of data to be pulled is in a form that the user fills in. START_DATE and END_DATE.

Any ideas how to accomplish this? I was thinking that I could do some sort of loop to write to a table for every date range within the selected range. Would this work? What is the right code?

Thanks so much!
 
I cannot tell exactly what you are doing.

However, you do not want to "join" theses tables, that means a 1:1, 1:many, or man:many relationship. You don't appear to have that any of those kinds of relationship. Your tables are related, but not directly.

10/19/06 21:51 - 10/20/06 6:19 is not a date range, it is a time range. I'd think in terms of of a "start time" and "end time."

Give a little more information on what you're trying to relate. Yopu probably want to use criteria from one table to lookup/store information in the second.
 
The outage info table has daily information with a date/time range for the outage. The cost table has daily information by hour. I want to create code that will pull the outage information based upon filters (already have a query set up for this) and convert the information to hourly information and dump it into a new table.
Basically if the outage is from 10/19/06 21:51 until 10/20/2006 6:19, i want a table that says for 10/19/06 hours 1-24, here are the outage minutes. For hours 0-20 there will be a 0, for hour 21 there will be a 51, for hours 22-24 there will be a 60. Same for 10/20/06 ~ hours 1-6 will have 60, hour 7 will have 19, and hours 8-24 will have 0s. Then I can match each hour up with the cost table for the formula OutageCost=(OutageHour1/60)*CostHour1
 

Users who are viewing this thread

Back
Top Bottom