applicants.sql
full name | company Id | CompanyLabel
Johny Doe | 1 |
Johny ben | 2 |
companylist.sql
companyid | Company name | CompanyLabel
1 | Starks Industry | Starks Industry - New York
2 | Captain Industry | Captain Industry - Paris
问题是我有:
5000名没有CompanyLabel的申请人
1000家不同的公司。
我用这个来获得CompanyLabel 1 by 1
UPDATE applicants set CompanyLabel = 'Starks Industry - New York' WHERE companyid = 1
如何在一次查询中执行所有操作?
答案 0 :(得分:0)
您可以使用加入并更新某些内容
update applicants a
join companylist c on c.companyid = a.companyid
set a.CompanyLabel = c.CompanyLabel