MERGE INTO T T1USING (SELECT a,b FROM T WHERE t.a=‘1001‘) T2ON ( T1.a=T2.a)WHEN MATCHED THEN UPDATE SET T1.b = 2WHEN NOT MATCHED THEN INSERT (a,b) VALUES(‘1001‘,2);
merge into
原文:http://www.cnblogs.com/Baronboy/p/7502154.html