MySQL error 1241: Operand should contain 1 column(s)

Kumaran Senapathy picture Kumaran Senapathy · Apr 4, 2013 · Viewed 150.4k times · Source

I am trying to Insert data from a table1 into table2

insert into table2(Name,Subject,student_id,result)
select (Name,Subject,student_id,result)
from table1;

Key for table2 is student_id.

Assume that there are not any duplicates.

I get the error: MySQL error 1241: Operand should contain 1 column(s)

There are only four columns in table2.

Answer

David picture David · Apr 4, 2013

Syntax error, remove the ( ) from select.

insert into table2 (name, subject, student_id, result)
select name, subject, student_id, result
from table1;