Recipe 4.11. Merging Records

wuxidba發表於2010-12-07
	1  merge into emp_commission ec
	2  using (select * from emp) emp
	3     on (ec.empno=emp.empno)
	4   when matched then
	5        update set ec.comm = 1000
	6        delete where (sal < 2000)
	7   when not matched then
	8        insert (ec.empno,ec.ename,ec.deptno,ec.comm)
	9        values   (emp.empno,emp.ename,emp.deptno,emp.comm)

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23895263/viewspace-681081/,如需轉載,請註明出處,否則將追究法律責任。

相關文章