gpt4 book ai didi

mysql - 如果提供嵌套子查询,查询不会被执行

转载 作者:行者123 更新时间:2023-11-30 00:08:20 25 4
gpt4 key购买 nike

对于下面的查询,它给出以下错误

Error Code: 1175. You are using safe update mode and you tried to update a table 
without a WHERE that uses a KEY column
To disable safe mode, toggle the option in Preferences -> SQL Editor -> Query Editor
and reconnect.

任何人都可以纠正我的查询错误吗?

UPDATE delivery p  SET p.OrderID =
(
SELECT OrderID from OrderTable o where o.DiagramID=p.DiagramID AND o.DeliveryDate=
(
Select min(o2.DeliveryDate) from OrderTable o2 where o2.DiagramId=o.DiagramID
)
)
where p.OrderID=0;

最佳答案

问题是,您正在 MySQL 安全模式下工作,该模式不允许您在 where 子句中不使用 KEY 的情况下运行任何更新。要禁用它,请使用

SET SQL_SAFE_UPDATES=0;

在运行查询之前

关于mysql - 如果提供嵌套子查询,查询不会被执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24314830/

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