Mysql 根據一個表數據更新另外一個表


update 更新表 set 字段 = (select 參考數據 from 參考表 where  參考表.id = 更新表.id);

update table_2 m  set m.column = (select column from table_1 mp where mp.id= m.id);

方法二:

  update table_1 t1,table_2 t2 set t1.column = t2.column where t1.id = t2.pid;

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM