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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Using nested Select / Corelated Subquery 1

Status
Not open for further replies.

SQLPilot

Technical User
Apr 6, 2001
1
US
I have a table that I have extracted portions of data into a CSV. Excel users updated the data and I now need to update numerous rows and columns. I have moved the data back into a temp table in SQL. I need to update the requirement and Description columns in the original table with the equivalent row from the temp table. I can link by the primary key column, as the key field was included in the original export.

I am sure that there is a way to use either a nested update / select query or a corelated subquery in an update statement to accomplish this, but am having total brain fry trying to remember the syntax.

Any help will be greatly appreciated.


 
How about something like:
Code:
update table set description = (select description from temptable tt where tt.key = table.key) where key in (select key from table)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top