根據查詢結果更新記錄

需要根據多個表的查詢結果更新數據,如下

update student t1,

(select t.id,b.name from student t inner join base_info b on t.no = b.no and b.flag = 1) t2

set t1.name = t2.name where t1.id = t2.id

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