DB2多表關聯更新


//同表更新同類型記錄總數
 update table1 t1 set t1.totlecount=(select count(t2.id) from table1 t2 where t1.lx=t2.lx)

//更新編號
 update table1 t1 set t1.tnum = (select z2.znum from ztable z1,ztable z2 where  t1.zid=z1.id and z1.zid=z2.bsm)


免責聲明!

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



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