简体   繁体   English

MySQL,将整个列替换为另一个表列

[英]Mysql, replace entire column with another tables column

I have a column in a table which needs to be replaced with a column from another table. 我在一个表中的一列需要替换为另一个表中的一列。 Basically one is the short description of items and the other (that was found in another table) is the long descriptions of the same items in the same order. 基本上,一个是项目的简短描述,另一个(在另一个表中找到)是对相同项目的相同顺序的长描述。

I'm pretty new to actually writing queries with mysql, (i've always relied on ActiveRecord or the like), so please don't newbie bash me on that. 对于使用mysql实际编写查询,我是一个新手,(我一直都依赖ActiveRecord或类似的东西),所以请不要新手对我ash之以鼻。

What would this query look like? 该查询是什么样的?

UPDATE
    FirstTable
    JOIN SecondTable ON FirstTable.ItemID = SecondTable.ItemID
SET
    FirstTable.Description = SecondTable.LongerDescription

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM