SQL question

I have two table.  Each has a description column and a code column.   I want both table to have the same data for both columns.  Currently, table one have  description and code populated.  Table two has only description populated.  Where description matches between the two tables, I wan the same code.

In pusedo SQL code, I need to do an UPDATE SET a.Code = b.code WHERE  a.description  = b.description.

How do I do this?
LVL 1
HLRosenbergerAsked:
Who is Participating?
 
StefanLambdaCommented:
You could try this :

UPDATE a
  SET a.Code = b.code
  FROM  table1 a, table2 b
  WHERE  a.description  = b.description.

or

UPDATE a
  SET Code = b.code
  FROM  table1 a, table2 b
  WHERE  a.description  = b.description.
0
 
HLRosenbergerAuthor Commented:
Thanks  !! That did the trick
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.