gpt4 book ai didi

MySQL 查询(将 SELECT 更改为 DELETE)

转载 作者:行者123 更新时间:2023-11-29 04:20:37 24 4
gpt4 key购买 nike

我有这个 mysql 查询:

SELECT 
F.ID,
F.REF1,
F.REF2
FROM FRIENDS F
LEFT JOIN ACCOUNTS A1 on A1.id = F.REF1
LEFT JOIN ACCOUNTS A2 on A2.id = F.REF2
WHERE A1.WEB_IP = A2.WEB_IP;

我正在尝试将其更改为 DELETE 命令而不是 SELECT。不知何故它现在工作。

无效的查询:

DELETE FROM FRIENDS WHERE LEFT JOIN ACCOUNTS A1 on A1.id = FRIENDS.REF1
LEFT JOIN ACCOUNTS A2 on A2.id = FRIENDS.REF2
WHERE A1.WEB_IP = A2.WEB_IP;

最佳答案

您可能想使用:

DELETE friends
FROM frineds
LEFT JOIN accounts a1 on a1.id = friends.ref1
LEFT JOIN accounts a2 on a2.id = friends.ref2
WHERE a1.web_ip = a2.web_ip;

您可能会找到此引用 useful

关于MySQL 查询(将 SELECT 更改为 DELETE),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25487395/

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