Reputation: 85
Would like to update the first column of a table while leaving the data of the other columns.
Example:
Pet Count
==============
Cat 4
Dog 1
Hamster 9
Update with this table:
Pet
===
Cat
Hamster
Monkey
Desired result:
Pet count
============
Cat 4
Hamster 9
Monkey
As you can see Dog fell out because it was not in the second table. Monkey was added with a blank count.
I though it was Update query but. Reading about update query it looks like they are only used for find and replace.
Upvotes: 0
Views: 298
Reputation: 3351
SELECT [Table2].Pet, [Table1].Count
FROM [Table2]
LEFT OUTER JOIN [Table1] ON [Table2].Pet=[Table1].Pet
Upvotes: 1