更新另一个表中的行 [英] Update rows from another table

查看:31
本文介绍了更新另一个表中的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含 2 列,Country 和 Qty 的表格.外地国家有所有国家的不同首字母缩略词.现在我的工作是用实际的国家名称替换这些首字母缩略词.现在有另一个包含首字母缩略词和相应国家名称的表格.我必须从第二个表中获取值并更新 Acronyms 匹配的第一个表.请帮忙..

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 one where Acronyms match. Please help..

推荐答案

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

这篇关于更新另一个表中的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆