2012-01-29 42 views
2

我將如何正確地做了以下DELETE聲明,影響多個表:MULT-表中刪除

DELETE FROM exchange_rates, raw_financials WHERE date='2011-12-01' 
+0

表格之間的連接列是什麼? – gbn 2012-01-29 18:49:44

回答

3

如果有某些表之間的鏈接,那麼你可以在兩個表之間執行連接。否則,如果沒有鏈接,我只會使用兩個單獨的SQL查詢。

DELETE FROM exchange_rates WHERE date='2011-12-01' 
DELETE FROM raw_financials WHERE date='2011-12-01' 
2

這樣的事情,但你需要指定JOIN條件

DELETE FROM exchange_rates er, raw_financials rf 
USING (the joining column(s) here) 
WHERE er.date = '2011-12-01'