I have a query. I would like to delete all selected rows in these 3 different tables Since I have a lot of INNER joins, I couldn't figure it out. My goal is to delete everything for these seller_ids.
SELECT * FROM orders a INNER JOIN order_items b ON a.order_id = b.order_id INNER JOIN order_item_histories c ON c.order_item_id = b.order_item_id WHERE a.seller_id IN (1, 3)
Version Postgres 10.3
I tried this but I couldn't succeed.
DELETE FROM USING orders USING order_items, USING order_item_histories WHERE orders.order_id = order_items.order_id AND order_items.order_item_id = order_item_histories.order_item_id AND orders.seller_id IN (1, 3)