mysql - 无法更新表格,但选择作品

标签 mysql ubuntu

我在 MySQL 中遇到了一个奇怪的问题,我尝试更新一个存在的表中的值,但得到一个错误,指出该表不存在,即使它存在。 SELECT 语句工作正常:

mysql> SELECT * FROM CurrentState;
+----+------------+--------+--------+
| ID | last_price | buyer  | seller |
+----+------------+--------+--------+
|  1 |       5.10 |   5.09 |   5.12 |
|  2 |     132.00 | 130.30 | 132.40 |
+----+------------+--------+--------+
2 rows in set (0.00 sec)

mysql> UPDATE CurrentState SET buyer = buyer;
ERROR 1109 (42S02): Unknown table 'CurrentState' in field list

我尝试以普通用户和 root 身份执行查询,我得到了相同的结果。问题是什么?我所做的唯一一件事就是为表创建了一个触发器,以防执行更新语句。但现在这甚至是不可能的。

感谢您的帮助!

编辑:添加触发器

CREATE TRIGGER push_changes AFTER UPDATE ON CurrentState FOR EACH ROW CALL winners_change(CurrentState.buyer,CurrentState.seller,CurrentState.last_price);

在我写这篇文章时,我猜问题出在 (CurrentState.buyer,CurrentState.seller,CurrentState.last_price); 部分,是否应该删除 CurrentState

最佳答案

您应该使用 NEW 而不是 CurrentState 来引用当前行。

关于mysql - 无法更新表格,但选择作品,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23041384/

相关文章:

node.js - 如何在 Docker 容器中同时运行 Node.js 和 MongoDB 交互式 shell

php - 无法使用php更新mysql数据库

mysql - 在 phpmyadmin 中将列插入到预先存在的表中

php - 我可以创建一个 mysql 数据库,其中数据从 excel 文件导入然后通过 UI 显示吗

c - 从内核劫持系统调用

postgresql - 尝试卸载 Postgres 服务器时出现 "Can' t locate PgCommon.pm”

php - 是否可以在所需循环之外创建数据库调用?

多次使用相同参数的Mysql Prepared Statement

r - 在 Ubuntu 16.04 Apache/2.4.18 (Ubuntu) 中安装 RApache : I get some errors

ruby-on-rails - Ubuntu 上 Rails 设置中的 ActiveRecord::ConnectionNotEstablished 错误