删除查询 MySQL:列计数与第 1 行的值计数不匹配 [英] Delete Query MySQL : Column Count Doesn't Match Value Count at Row 1

查看:88
本文介绍了删除查询 MySQL:列计数与第 1 行的值计数不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从具有特定 ID 的表中删除所有行.我的查询是:

I am trying to delete all rows from a table with a particular id. my query is:

DELETE FROM table_name WHERE x_id='46';

返回的错误是:

#1136 - 列数与第 1 行的值数不匹配

我的表有一个复合主键 x_id 是主键中的列之一.

my table has a composite primary key x_id is one of the columns in the primary key.

请帮忙!

推荐答案

该错误对于删除语句来说很奇​​怪.它很可能来自由于删除而执行的写入错误的触发器.

That error is strange for a delete statement. It is most likely coming from badly written trigger that is being executed as a result of the delete.

此错误很可能会在如下所示的插入语句中遇到:

This error would most likely be encountered on an insert statement such as the following:

insert into foo(bar, baz)
select bar, baz, foobar, 2
from myTable

注意 insert 语句如何指定 2 列,但提供 4 个值.

Note how the insert statement specifies 2 columns, but provides 4 values.

这篇关于删除查询 MySQL:列计数与第 1 行的值计数不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆