我有两张桌子。
表: gender_age_train
index Unnamed: 0 device_id gender age group phone_brand
---------- ---------- -------------------- ---------- ---------- ---------- -----------
1 0 -8076087639492063270 M 35 M32-38 小米
2 1 -2897161552818060146 M 35 M32-38 小米
3 2 -8260683887967679142 M 35 M32-38 小米
4 3 -4938849341048082022 M 30 M29-31 小米
5 4 245133531816851882 M 30 M29-31 小米
6 5 -1297074871525174196 F 24 F24-26 OPPO
7 6 236877999787307864 M 36 M32-38 酷派
8 7 -8098239495777311881 M 38 M32-38 小米
9 8 176515041953473526 M 33 M32-38 vivo
10 9 1596610250680140042 F 36 F33-42 三星 表: chinese_latin_translation
index chinese latin_brands
---------- ---------- ------------
1 三星 samsung
2 天语 Ktouch
3 海信 hisense
4 联想 lenovo
5 欧比 obi
6 爱派尔 ipair
7 努比亚 nubia
8 优米 youmi
9 朵唯 dowe
10 黑米 heymi 如果gender_age_train表中的品牌以中文字母存在,该如何用latin_brands列中的翻译替换该品牌
如果有翻译的话,我不想替换完整的列,只想替换行。
数据集的行数超过1mio。本例中的重要列只有phone_brand和latin_brands
查询示例:
SELECT latin_brands, phone_brand FROM gender_age_brand_train LEFT JOIN chinese_latin_translation on gender_age_brand_train.phone_brand = chinese发布于 2017-11-06 21:07:52
这应该符合您请求,使用update行的内部联接
UPDATE T2
SET T2. Name = T1 .Name
FROM gender_age_train as T2 INNER JOIN Table1 as T1
ON T1. Id = T1 .Id;现在你可以设置你的查询了。
https://stackoverflow.com/questions/47137610
复制相似问题