雙表聯合Update

將tab1的psw改爲tab2的password 
tab1.id=tab2.id 

且tab1與tab2數據一一對應,不能出現一對多的情況.


update tab1 set tab1.psw = (select tab2.password from tab2 where tab2.id = tab1.id) where tab1.id in (select tab2.idfrom tab2) 

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