Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

copy one column from one table to another

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) 
like image 533
JPro Avatar asked Jan 06 '10 19:01

JPro


People also ask

How do I copy a column from one table to another in Excel?

Add index columns in both tables then merge the tables using the two index columns. or if the data source is excel you can copy from excel and paste into your table in power query.

How do I copy a column from one table to another in mysql?

To copy from one column to another, you can use INSERT INTO SELECT statement.


1 Answers

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 
like image 173
Benoît Vidis Avatar answered Sep 25 '22 00:09

Benoît Vidis