mysql update 四種情況

級聯更新第1種情況:

update t1, t2

set t1.x = t2.x, t1.y = t2.y

where t1.id = t2.id


級聯更新第2種情況:

update t1,

(select * from t2) as t2

set t1.x = t2.x, t1.y = t2.y

where t1.id = t2.id


級聯更新第3種情況:

update (select c from t1 group by c) as temp, t2, t1

set t1.x = t2.x, t1.y = t2.y

where t1.id = t2.id and temp.id = t2.id


級聯更新第4種情況:

update t1 left join t2 on t1.id = t2.id

set t1.x = t2.x, t1.y = t2.y

where t1.id = xx


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章