gpt4 book ai didi

mysql - 从 MySQL 中的连接 View 表中删除行

转载 作者:行者123 更新时间:2023-11-29 13:34:39 25 4
gpt4 key购买 nike

我需要删除表中的 45K 行(共 125k 行)。

 DELETE FROM `tablename` WHERE `name` IS NULL ;

已返回

ERROR 1395 (HY000): Can not delete from join view

最佳答案

执行SHOW CREATE VIEW tablename来查看哪些表位于连接 View 的select中。结果将类似于:

CREATE VIEW tablename AS SELECT name, f2, f3 … FROM table1;

当您知道表的名称中有一个名为 name (table1) 的列时,您可以执行删除操作:

DELETE FROM `table1` WHERE `name` IS NULL ;

关于mysql - 从 MySQL 中的连接 View 表中删除行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18922019/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com