Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 列计数与第行的值计数不匹配_Mysql_Sql - Fatal编程技术网

Mysql 列计数与第行的值计数不匹配

Mysql 列计数与第行的值计数不匹配,mysql,sql,Mysql,Sql,获取错误- 错误代码:1136。列计数与第行的值计数不匹配 Qoute字符串,并确保两种情况下的列数相同20: 被视为标识符列名 也最好使用插入。。。为可读性选择: INSERT INTO clnt_reports_01 (r_id,cl_no,servi,size,vol,deliver_point,port_,a_port,road,term,compet,speed,rcomments,stage,meetrating,username,user_status,kids,hobbies,c

获取错误-

错误代码:1136。列计数与第行的值计数不匹配

Qoute字符串,并确保两种情况下的列数相同20:

被视为标识符列名

也最好使用插入。。。为可读性选择:

INSERT INTO clnt_reports_01 (r_id,cl_no,servi,size,vol,deliver_point,port_,a_port,road,term,compet,speed,rcomments,stage,meetrating,username,user_status,kids,hobbies,comments)

VALUES (1, 123123, 'test', 'test', 'test', 'test', 'test', 'test', 'test', 'test', 1, 'test', 'test', 3, 5, 'test', 'test', 5, 'test', 'test');
编辑:

您指定了21列,但只提供了20个值,因此不匹配

cl_no似乎重复了两次。去掉那个

文本需要使用单引号而不是双引号

INSERT INTO clnt_reports_01 (
  r_id,
  cl_no,
  servi,
  size,
  vol,
  deliver_point,
  port_,
  a_port,
  road,
  term,
  compet,
  speed,
  rcomments,
  stage,
  meetrating,
  username,
  user_status,
  kids,
  hobbies,
  comments)
SELECT
  1       AS r_id,
 123123   AS cl_no,
 'test'   AS servi,
 'test'   AS size,
 'test'   As vol, 
 'test'   AS deliver_point,
 'test'   AS port_,
 'test'   AS a_port,
 'test'   AS road,
 'test'   AS term,
  1       AS compet,
 'test'   AS speed,
 'test'   AS rcomments,
  3       AS stage,
  5       AS meetrating,
 'test'   AS username,
 'test'   AS user_status,
  5       AS kids,
 'test'   AS hobbies,
 'test'   AS comments;

嗯,您的列计数21与值计数20不匹配,您试图在21列中插入20个内容

这是由错误给出的,错误是

错误代码:1136。列计数与第行的值计数不匹配


插入查询以指定21列并传递值20。

您为21列提供了20个值,可能是因为您已经列出了两次列cl\u no。即使修复了列/值计数问题,也会出现此错误

错误代码:1136

列计数与第1行的值计数不匹配

对于此问题:

错误代码:1136。列计数与第行的值计数不匹配

cl_不使用两次,从该列中移除一次

可以使用单引号而不是双引号

例如:


测试->“测试”

值1123123,“测试”,“测试”,“测试”,“测试”,“测试”,“测试”,“测试”,“测试”,“测试”,1,“测试”,“测试”,3,5,“测试”,“测试”;像这样?仍然得到相同的错误@LAD2025计算字段名,然后计算值..21列在INSERT中,20列为值MSQL可以使用双引号查看@amdixon它取决于ok,但是错误信息很清楚地表明了这一点case@amdixon没有作者变更question@rapidvaters查看我的更新答案并插入选择请在答案中添加一些解释,以便其他人可以从中学习
INSERT INTO clnt_reports_01 (
  r_id,
  cl_no,
  servi,
  size,
  vol,
  deliver_point,
  port_,
  a_port,
  road,
  term,
  compet,
  speed,
  rcomments,
  stage,
  meetrating,
  username,
  user_status,
  kids,
  hobbies,
  comments)
SELECT
  1       AS r_id,
 123123   AS cl_no,
 'test'   AS servi,
 'test'   AS size,
 'test'   As vol, 
 'test'   AS deliver_point,
 'test'   AS port_,
 'test'   AS a_port,
 'test'   AS road,
 'test'   AS term,
  1       AS compet,
 'test'   AS speed,
 'test'   AS rcomments,
  3       AS stage,
  5       AS meetrating,
 'test'   AS username,
 'test'   AS user_status,
  5       AS kids,
 'test'   AS hobbies,
 'test'   AS comments;
INSERT INTO clnt_reports_01 ( 
r_id,
cl_no,
servi,
size,
vol,
deliver_point,
port_,
a_port,
road,
term,
compet,
speed,
rcomments,
stage,
meetrating,
username,
user_status,
kids,
hobbies,
comments)

VALUES (1, 
123123, 
'test', 
'test', 
'test', 
'test', 
'test', 
'test', 
'test', 
'test', 
1, 
'test', 
'test', 
3, 
5,
'test', 
'test', 
5, 
'test', 
'test');
INSERT INTO fgm_pastor(
matriculePastor,
pastorName,
pastorSurname,
pastorBirthdayDate,
birthdayPlace,
pastorFathername,
pastorMothername,
pastorSexe,
pastorPhone,
pastorEmail,
dateConversion,
workBeforeBibleSchool,
rankProbation,
areaOfCalling,
nberYearArea,
nbreYearDistrict,
martialSituation,
nationality,
pastorAdresse,
photoProfil,
raisonIndispoMissionnaire,
id) 
VALUES
(
'matriculetest3',
'nom test',
'prenomtest',
'2013-09-12',
'Dagobert',
'mon pere resr' ,
'ma mere test',
'M',
'phone test',
'pastorEmail test',
'2018-12-28',
'infomaticien',
'rank test',
'area test',
1,
3,
'Single test',
'Cameroun test',
'adresse test',
'phototest'
'RAS',
4
);