如何从三个表中删除行-查询错误 [英] How to delete rows from three tables - query error

查看:73
本文介绍了如何从三个表中删除行-查询错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I need to delete rows from multiple mysql tables (3). this is my query it show a error but I create this query according to the examples and tutorials.

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,d
  FROM customers c
  JOIN orders o
    ON o.customers_id = c.id
  JOIN order_detail d
    ON d.orders_id = o.id
 WHERE c.id IN (66,67,68,90,85,81,80,78,76,74,71,118,113,110,149)

这篇关于如何从三个表中删除行-查询错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆