Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

#1136 - Column count doesn't match value count at row 1

Tags:

sql

mysql

I am trying to insert ID field from one table to another using below query:

INSERT INTO `srikprag_db`.`acbalance`
SELECT `id` FROM `srikprag_mlm`.`member_table`

Error is showing:

#1136 - Column count doesn't match value count at row 1

What is the reason for this error?

like image 804
Haren Sarma Avatar asked Apr 30 '13 06:04

Haren Sarma


2 Answers

You did not define the destination column on where the values from the SELECT statement will be saved, eg.

INSERT INTO srikprag_db.acbalance (ID)            -- <<== destination column
SELECT id
FROM   srikprag_mlm.member_table

probably you want to manipulate records across database.

like image 70
John Woo Avatar answered Nov 20 '22 15:11

John Woo


The problem is with your query you are not assigning any value to the column. You have 1 column with zero value.

like image 28
chandresh_cool Avatar answered Nov 20 '22 17:11

chandresh_cool