Link to home
Start Free TrialLog in
Avatar of YZlat
YZlatFlag for United States of America

asked on

problems with Update query with sub-select

I have two tables, Table1 and Table2 of the following structure:

Table1
_______
PersonNumber - Primary key
RecordID
Name
Address
Phone
EmailAddress


Table2
________
RecordID
Email


RecordID is a numeric text field. In Table1 all RecordID are blanks. Table1 and Table2 are related by Table2.Email and Table1.EmailAddress fields. What I want is to transfer RecordID from Table2 to Table1.

I have the following sql statement:

UPDATE Table1 INNER JOIN Table2
ON Table1.EmailAddress=Table2.Email
SET Table1.RecordID=(SELECT Table2.RecordID FROM Table2)

But when I try to run this query I get an error "Operation must use an updateable query"

I'm using ms access
ASKER CERTIFIED SOLUTION
Avatar of heer2351
heer2351

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Steve Bink
Same thing, different syntax:

UPDATE Table1 SET RecordID = Table2.[RecordID] FROM Table1,Table2 WHERE Table1.[EmailAddress]=Table2.[Email]
Avatar of YZlat

ASKER

perfecto!
thanks