MySQL #1136 - 列数与第 1 行的值数不匹配
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16293681/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
#1136 - Column count doesn't match value count at row 1
提问by Haren Sarma
I am trying to insert ID field from one table to another using below query:
我正在尝试使用以下查询将 ID 字段从一个表插入到另一个表:
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
#1136 - 列数与第 1 行的值数不匹配
What is the reason for this error?
这个错误的原因是什么?
回答by John Woo
You did not define the destination column on where the values from the SELECTstatement will be saved, eg.
您没有定义SELECT将保存语句中的值的目标列,例如。
INSERT INTO srikprag_db.acbalance (ID) -- <<== destination column
SELECT id
FROM srikprag_mlm.member_table
probably you want to manipulate records across database.
可能您想跨数据库操作记录。
回答by Osiris
SELECT `id` FROM `srikprag_mlm`.`member_table`
returns a result set with only 1 column (id).
返回只有 1 列 ( id)的结果集。
The acbalancetable probably has more than 1 column.
该acbalance表可能有超过 1 列。
回答by chandresh_cool
The problem is with your query you are not assigning any value to the column. You have 1 column with zero value.
问题在于您的查询没有为该列分配任何值。您有 1 列的值为零。

