gpt4 book ai didi

mysql - 可以选择但不能删除

转载 作者:行者123 更新时间:2023-12-01 00:14:39 25 4
gpt4 key购买 nike

我很难从我的 MySQL 表中删除所需的行。我正在使用相当复杂的子查询来选择行,但出于某种原因,我无法使用类似的语法删除它们。

delete * from table1 as t1
where t1.col1 in
(select y.col1
from table2 x
join
(select col1, col2
from table2
where col2 like "%- 2%") y
on x.col2 = replace(y.col2, "- 2", ""));

同样,我可以选择要删除的确切行,但是当我将查询更改为删除时,出现以下错误:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near...

非常感谢任何帮助。

最佳答案

删除 DELETE 之后的 *。您通常不会删除单个列,而是删除整行。

关于mysql - 可以选择但不能删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7114313/

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