Re: UPDATE with a SELECT - is it possible?
- From: "Jesper F" <askfortheemail@xxxxxxx>
- Date: Fri, 17 Mar 2006 13:57:25 +0100
by joining on non-pk fields (a "group field", or could be "group fields"),
a specific summary record may be joined to *one/several/or many*
records in the base table.
In the case of the SUM example, we would start with
setting all summary.SumOfAmount to 0.
For every record in summary table, *all* the records in
basetable are "cycled through" where they match on
the "group" fields, resulting in an aggregate sum.
I'm not saying this is the best way to do this, but
just wanted to illustrate the effect of JOIN
in a "range-to-range" update query if you do
not join on the primary keys.
If you do not join your ranges on pk's
(or join fields that produce only one range record
per only one record in the other range),
then you will be doing the equivalent of
Michel's LAST example.
Hi Gary, Thank you very much for that very thorough reply.
I think I can use the joins in my situation. Great stuff.
Jesper
.
- References:
- UPDATE with a SELECT - is it possible?
- From: Jesper F
- Re: UPDATE with a SELECT - is it possible?
- From: Gary Walter
- UPDATE with a SELECT - is it possible?
- Prev by Date: Re: how to avoid slow count function
- Next by Date: Re: Cannot get Between...and criteria to run
- Previous by thread: Re: UPDATE with a SELECT - is it possible?
- Next by thread: Re: UPDATE with a SELECT - is it possible?
- Index(es):
Relevant Pages
|