Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 UPDATE Table A with data from Table B

Author  Topic 

a2l2en
Starting Member

11 Posts

Posted - 2005-08-23 : 12:42:08
I'm doing a migration and need to clean up a table. I've done this in Oracle but can't get the syntax right for SQL.

Please help. Here is my feeble attempt:

UPDATE tableA
SET tableA.username = tableB.username
FROM tableA
JOIN tableB
ON tableA.email = tableB.email

mmarovic
Aged Yak Warrior

518 Posts

Posted - 2005-08-23 : 13:09:25
[code]update a
set a.userName = b.UserName
from tableA as a
join tableB as b on a.email = b.email[/code]
Go to Top of Page

a2l2en
Starting Member

11 Posts

Posted - 2005-08-23 : 14:22:12
Thanks! That worked.

I love this site.
Go to Top of Page
   

- Advertisement -