有時候咱們的數據不會當即去更新,而是存在另一張表中等待更新,這是在平常開發中常見的操做。mysql
update e set e.SAL=ns.SAL+e.SAL, e.COMM=ns.SAL from emp e,new_sal ns where e.EMPNO=ns.EMPNO
mysql 能夠下面這樣:sql
update emp e set (e.SAL,e.COMM)=(select e.SAL+ns.SAL,ns.SAL from new_sal ns where ns.EMPNO=e.EMPNO) where exists ( select null from new_sal ns where ns.EMPNO=e.EMPNO )
資料整理中,過多資料,思路正在路上。code