UPDATE tableB ...... from tableB GROUP BY .....
you have a set of data called tableB in one state and you are trying to
change it into another set of data based on an operation upon a subset of
that data and leave the updated set of data in a known state, when changing
that data might affect the criteria. Writing the algorithms to ensure that
those conditions will be met is a major task, and it is simpler to not allow
such operations. Nothing to do with it being Microsoft.
Roger said:
Yea, that looks like the route I am going to have to take. I am
shocked that Access does not support it.
Although its microsoft.
Thanks
Roger
dberman wrote:
Probably not a direct query. Chaining two queries will work.
1. Make table query
SELECT Dates.Name, Max(Dates.SubDate) AS MaxOfSubDate INTO [Dates-Max]
FROM Dates
GROUP BY Dates.Name;
2. Update query
UPDATE [Names] INNER JOIN [Dates-Max] ON Names.Name = [Dates-Max].Name
SET
[Names].MaxDate = [Dates-Max].[MaxOfSubDate];
Not totally satisfactory, but will function.
--
Don Berman
Computer Sciences Corp.
:
Thnaks for the reply.
I am not looking for the subquery to be in the where clause.
I need it to be in the SET datecompleted = (select MAX(sampleDT) from
tableB ....
tableA
ID
datecompleted
tableB
ID
sampleDT
(TableA) (1 -> Many) (TableB) relationship
so I need Max(sampleDT) in the subquery to put into date completed.
dberman wrote:
You want something like:
UPDATE [table1] SET [item1] = whatever
WHERE [item2] in (select [item2] from table2 where itemx like "xx*");
table1 and 2 can be the same table. The select must return the same
data
type as item2 in the WHERE clause.
Good luck.
--
Don Berman
Computer Sciences Corp.
:
Does anyone know how to do something like this in Access 97?
UPDATE tableB SET
date_ferment_completed =
EXISTS (
SELECT fieldID, MAX(sampleDT)
from
tableB
GROUP BY fieldID
)
I get an "Operation must use an updatable query" error.
I tried this as well
UPDATE tableB SET
date_ferment_completed =
(
SELECT MAX(sampleDT)
from
tableB
)
The inner query gets only one value for the return.
Thanks