Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Building up the second table using the first

Status
Not open for further replies.

raydenl

Programmer
Sep 22, 2003
22
NZ
OK, next question.

I have one table that contains all possible data.

And another table that under perfect conditions should contain exactly the same data and number of rows, with the only difference being the myFactor column values.

There are 48 periods per day.

The structure of both tables is as such:

myDate myPeriod myCode myFactor
2006-03-01 1 AAA 1.56
...
2006-03-01 48 AAA 1.34

Under imperfect conditions (which happens quite regularily) the second table may contain some NULL values in the myFactor column and some dates may be missing

What I need to be able to do is build up the second table with values from the first table whenever a NULL values is encountered or a date is missing.

So the second table should end up with exactly the same number of rows as the first and contain no NULL values in the myFactor column.
 
I had a similar problem - an account might have several customers and I had to find the youngest customer. What I did was create details for each account-customer pairing. Then create another table that grouped them by account number and found the maximum for various values.

This isn't quite the same problem, but maybe you can adapt the idea.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top