将一列从一张表复制到另一张表 [英] copy one column from one table to another
本文介绍了将一列从一张表复制到另一张表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对如何使用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
这篇关于将一列从一张表复制到另一张表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文