有時候我們需要刪除表中部分內容,或刪除一個表中在另一個表中已經存在的內容,可以用以下方法:
1、delete from t1 where 條件;
2、delete t1 from t1, t2 where 條件;
3、delete t1, t2 from t1, t2 where 條件;
eg:
刪除表t1已經在表t2中存在的數據:
DELETE t1 FROM table_1 t1, table_2 t2
WHERE t1.id=t2.id and t1.year=t2.year and t1.month=t2.month;