InstructionWhich7142
Registered User.
- Local time
- Today, 23:13
- Joined
- Feb 24, 2010
- Messages
- 206
I have an update query, it updates a field with a calculated value which is based on the same field (but of the level above)
Surprisingly it actually does what I want! which is:
From a given top level value (where [sndbasis].[pa_irn]="") , calculate the value for the level 1s, then from those values the level 2s and so on,
For roughly 160k records it does over 800k updates, which I guess is how it manages this?
I would like to know if this is an acceptable outcome and also how/why it is able to do this ?
and how it knows to recalculate some values when their source values change?
Code:
UPDATE sndbasis LEFT JOIN sndbasis AS sndbasis_1 ON
(sndbasis.ijn=sndbasis_1.ijn) AND (sndbasis.pa_irn=sndbasis_1.irn)
SET sndbasis.requirement = IIf([sndbasis].[pa_irn]<>"",[sndbasis].[multiple]*[sndbasis_1].[requirement],[sndbasis].[requirement]);
From a given top level value (where [sndbasis].[pa_irn]="") , calculate the value for the level 1s, then from those values the level 2s and so on,
For roughly 160k records it does over 800k updates, which I guess is how it manages this?
I would like to know if this is an acceptable outcome and also how/why it is able to do this ?
and how it knows to recalculate some values when their source values change?