A
AnExpertNovice
Trying to update a table with data from another table. The source table is
complex because the effective and termination dates may overlap. In some
cases the first record is needed (at time of incident) and in some cases the
last record is needed (current situation). These dates are needed for
selection only from the source table.
Proper selection requires two queries (1: sort and select 2: a group on key
fields and either a first or last on non-key fields). The resulting query
creates a 1:1 relationship with the table to be updated based on a single
field which is the table's primary key field.
Of course the source query is not updateable because of the GROUP so it
appears that it is unable to be used to update the table.
Must a table be created just to update the first table?
If so, is it because the non-updateable query *MIGHT* create a 1:M
relationship?
Here is an abbreviated (table and field names have been shortened) version
of the query.
(of course the field named qry.key is not really a key but is the same as
tbl.key)
UPDATE tbl
INNER JOIN qry
ON tbl.key = qry.key
SET tbl.objfld = qry!srcfld;
complex because the effective and termination dates may overlap. In some
cases the first record is needed (at time of incident) and in some cases the
last record is needed (current situation). These dates are needed for
selection only from the source table.
Proper selection requires two queries (1: sort and select 2: a group on key
fields and either a first or last on non-key fields). The resulting query
creates a 1:1 relationship with the table to be updated based on a single
field which is the table's primary key field.
Of course the source query is not updateable because of the GROUP so it
appears that it is unable to be used to update the table.
Must a table be created just to update the first table?
If so, is it because the non-updateable query *MIGHT* create a 1:M
relationship?
Here is an abbreviated (table and field names have been shortened) version
of the query.
(of course the field named qry.key is not really a key but is the same as
tbl.key)
UPDATE tbl
INNER JOIN qry
ON tbl.key = qry.key
SET tbl.objfld = qry!srcfld;