我想从几张表中删除所有具有productid ='value'的行,因此我尝试在它们之间进行联接,但给我一个错误
sql命令未正确结束
所以我在问这是否真的可以工作,如果没有人可以告诉我该怎么做?
DELETE FROM
products, products_admin, products_category, products_seller, categories
USING
products
JOIN
products_admin ON products_admin.productid = products.productid
JOIN
products_category ON products_category.productid = products.productid
JOIN
products_seller on products_seller.productid = products.productid
JOIN
categories on categories.productsid = products.productid
WHERE
products.productid = 'value';
答案 0 :(得分:1)
如果您使用ON DELETE CASCADE
定义了外键,则从产品表中删除将删除所有关联表中的记录。参见https://www.techonthenet.com/oracle/foreign_keys/foreign_delete.php