?
Solved

problems with Update query with sub-select

Posted on 2004-03-25
3
Medium Priority
?
1,252 Views
Last Modified: 2010-10-06
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
0
Comment
Question by:YZlat
3 Comments
 
LVL 23

Accepted Solution

by:
heer2351 earned 320 total points
ID: 10682099
Your syntax is almost correct:

UPDATE Table1 INNER JOIN Table2
ON Table1.EmailAddress=Table2.Email
SET Table1.RecordID=Table2.RecordID
0
 
LVL 51

Expert Comment

by:Steve Bink
ID: 10682121
Same thing, different syntax:

UPDATE Table1 SET RecordID = Table2.[RecordID] FROM Table1,Table2 WHERE Table1.[EmailAddress]=Table2.[Email]
0
 
LVL 35

Author Comment

by:YZlat
ID: 10682176
perfecto!
thanks
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question