有時候刪除資料必須關聯另一張表才能篩選出來
就必須update和join 同時
update table1 ,table2
set table1.column = table2.column
where table1.column2 = table2.column2
或者
update table1 inner join table2 on (table1.column2 = table2.column2)
set table1.column = table2.column
where table1.column2 = table2.column2
那delete呢?
其實也是一樣
delete
from table1
from table1
using table1 join table2 on table1.column2 = table2.column2
where ….
where ….