gpt4 book ai didi

mysql - 如何从三个表中删除行 - 查询错误

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

我需要从多个 mysql 表中删除行 (3)。这是我的查询,它显示错误,但我根据示例和教程创建了此查询。

DELETE 
FROM customers
, orders
, order_detail
USING customers
JOIN orders
JOIN order_detail
WHERE customers.id = orders.customers_id
AND orders.id = order_detail.orders_id
AND customers.id IN (66,67,68,90,85,81,80,78,76,74,71,118,113,110,149)

最佳答案

这样试试..

DELETE c, o, od
FROM customers as c
JOIN orders as o ON c.id = o.customers_id
JOIN order_detail as od ON o.id = od.orders_id
WHERE c.id IN (66,67,68,90,85,81,80,78,76,74,71,118,113,110,149)

更多引用http://dev.mysql.com/doc/refman/5.7/en/delete.html

关于mysql - 如何从三个表中删除行 - 查询错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38781064/

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