2017-09-25 72 views
1

您可以請看看這個查詢,這是導致計數不匹配錯誤,但我有相同數量的列和值。#1136 - 列數不匹配第1行的值計數

這是我的表結構

ID| name1 | name2 | name3 | name4 | name5 | table_name 

insert into `tnames` (`'name1','name2','name3','name4','name5','table_name'`) 
values ('test','test','test','test','test','table_name') 
+1

從name1列和table_name列刪除反引號n –

+0

刪除反引號也不起作用@AnkitAgrawal –

+0

@KhiradBanu刪除反標或刪除同樣的錯誤後會出現新錯誤嗎? –

回答

2

試試這個

insert into `tnames` (`name1`,`name2`,`name3`,`name4`,`name5`,`table_name`) 
values ('abc','xyz','pqr','erg',) 
1

喜檢查Mysql的插入查詢語法https://www.w3schools.com/sql/sql_insert.asp

插入查詢不接受字段名

單/雙引號
insert into `tnames` (`'name1','name2','name3','name4','name5','table_name'`) 
values ('test','test','test','test','test','table_name') // Unnecessary single quotes for field names 

所以,請更改喜歡這個

insert into `tnames` (name1,name2,name3,name4,name5,table_name) 
    values ('test','test','test','test','test','table_name') 

這將工作

-1

intenta quitar拉斯科米利亞斯,雅雀靛UNA索拉ENTRADA德DATOS:

ID| name1 | name2 | name3 | name4 | name5 | table_name 

insert into tnames values 
(null, 'name1','name2','name3','name4','name5','table_name') 
//null is by the column id, if you have it as auto increment you will not have problem 


//also verify the type of data that accepts the column in your database 

我希望它爲你的作品,祝你好運

//si hablas español, traduce tambien los comentarios para que comprendas mejor 
相關問題