将一列从一个表复制到另一个

2022-01-17 00:00:00 sql-update mysql

我对如何使用 where 将列从一个表复制到另一个表感到困惑.我写了 SQL 查询,但它说超出事务锁定时间或查询返回多于一行.
使用 mysql
基本上,
我有:

I am confused about how to copy a column from one table to another table using where. I wrote SQL query but it says transaction lock time exceeded or query returns more than one row.
using mysql
Basically,
I have:

Table 1:  Results
BuildID  platform_to_insert

Table 2:  build
BuildID correct_platform

update results set results.platform_to_insert 
     = (select correct_platform from  
       build where results.BuildID = build.BuildID)

推荐答案

我认为你不需要子查询.

I do not believe you need a sub query.

UPDATE results, build
SET    results.platform_to_insert = build.correct_platform
WHERE  results.BuildID = build.BuildID

相关文章