有人能给我解释一下。。。:)
(使用MySQL 5.6.13)

UPDATE offer SET cosid=1 WHERE id=40;
Query OK, 1 row affected (0.07 sec)
Rows matched: 1  Changed: 1  Warnings: 0

UPDATE offer SET cosid=4 WHERE id=40;
ERROR 1242 (21000): Subquery returns more than 1 row

UPDATE offer SET cosid=5 WHERE id=40;
Query OK, 1 row affected (0.04 sec)
Rows matched: 1  Changed: 1  Warnings: 0

除以下四项外,接受所有有效指标:(
这是报价表:
CREATE TABLE offer (
  id               bigint(20) NOT NULL AUTO_INCREMENT,
  authorid         bigint(20) NOT NULL,
  offered_designid bigint(20) NOT NULL,
  cdid             bigint(20),
  cosid            bigint(20) NOT NULL,
  PRIMARY KEY (id),
  UNIQUE INDEX (id)) ENGINE=InnoDB;

有什么问题吗?
编辑:这是当前cos表:
SELECT * FROM cos;
+----+-------------+
| id | offer_state |
+----+-------------+
|  1 | active      |
|  5 | cancelled   |
|  3 | inactive    |
|  4 | realized    |
|  2 | waiting     |
+----+-------------+

一组5行(0.00秒)

最佳答案

正如ypercube在评论中所说,你已经确认,触发器是罪魁祸首!

关于mysql - 没有子查询的UPDATE引发错误:子查询返回多于1行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18708376/

10-12 22:57