Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update query with data from other tables 1

Status
Not open for further replies.

georgeous

Programmer
Jul 11, 2001
38
GB
Is it possible to update a field in one table with data from fields in another?

If so, how would the syntax go:

would it be

UPDATE stuff
set fileid = (the field from the file table)
where stuffid = .......

any help would be appreciated

thanks in advance
 
something like this:

Update Mytable m SET
col1=0.fielda,
col2=0.fieldb
from Mytable m
Inner Join OtherTable o
on m.CommonColumn = o.CommonColumn
 
I forgot you wanted a Where clause.
(But it's easy to see where it would go.)

Update Mytable m SET
col1=o.fielda,
col2=o.fieldb
from Mytable m
Inner Join OtherTable o
ON m.CommonColumn = o.CommonColumn
Where blah blah blah
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top