开发者

Update rows from another table [duplicate]

This question already has answers here: How do I UPDATE from a SELECT in SQL Server? (38 answers) Closed 8 years ago.

I have a table with 2 columns, Country and Qty. the field country has distinct acronyms of all the countries. Now my job is to replace those acronyms with the actual country name. Now there is another table with acronyms and corresponding country names. I have to take the values from this second table and update the first 开发者_StackOverflow社区one where Acronyms match. Please help..


UPDATE  q
SET     country = a.country
FROM    quantity q
JOIN    acronym a
ON      a.acronym = q.country
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜