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.
Syntax error, remove the ( )
from select
.
insert into table2 (name, subject, student_id, result) select name, subject, student_id, result from table1;
Just remove the (
and the )
on your SELECT statement:
insert into table2 (Name, Subject, student_id, result) select Name, Subject, student_id, result from table1;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With