2

有人可以向我解释这个... :) (使用 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 秒)

4

1 回答 1

3

正如 ypercube 在评论中所说,并且您已经确认,触发器是这里的罪魁祸首!

于 2014-07-02T03:22:20.110 回答