Question complex update query

InstructionWhich7142

Registered User.
Local time
Today, 13:58
Joined
Feb 24, 2010
Messages
206
for two initial questions i have on this - see end :)

I have a table of data which forms trees (ie one record relates to another with a internal reference number) this goes on up to 20 levels up (/down) the tree,

the fields are basically:

code (the code for the thing)
requirement (howmany of this are needed)
multiple (the number of these needed if a parent requires it)
date_required
job (the job this is needed for)
irn (its reference number)
pa_irn (the reference of its parent)
allocation (howmany of these things are already avilable to this job {a total by code and job})
stock (howmany of these things are in general stock {a total by code basically})
delta (the difference between demand and supply)

nothing has as delta filled in
the top level records already have requirements against them, all the other dont have requirements filled in either.

i need to subtract the supply [available on each date] from the requirements to give the delta,

then i move onto a child which multiplies the delta of the parent by its on multiple to give the requirement of the child then subtract the supply again to work out the delta for the child before moving onto the next level down

[i also need to take into account that bits ordered in have a date and need to be matched - this is stored on another table]

having tried to write this out to explain it i'm concerned i wont be able to do this in one pass with an update query :/


currently my two questions are:

does the order of data in the tables effect an update query?

when doing DSUMs on select queries you can use a value from the current record as part of the criteria by having it as a field on the query with a different name specified then calling that name into the dsum's criteria against "table.origional_field_name" - i'm not sure thats the right way do to it and how do i do this on update queries as they can't have fields on just for that purpose?
 

Users who are viewing this thread

Back
Top Bottom