oracle的minus返回第一個表中有、第二個表中沒有的數據
CREATE TABLE hovertree_union_1 ( id INT, val VARCHAR(10) ); CREATE TABLE hovertree_union_2 ( id INT, val VARCHAR(10) ); INSERT INTO hovertree_union_1 VALUES(1, 'A'); INSERT INTO hovertree_union_1 VALUES(2, 'B'); INSERT INTO hovertree_union_1 VALUES(3, 'C'); INSERT INTO hovertree_union_2 VALUES(1, 'A'); INSERT INTO hovertree_union_2 VALUES(1, 'A'); INSERT INTO hovertree_union_2 VALUES(2, 'B'); INSERT INTO hovertree_union_2 VALUES(4, 'D'); SQL> SELECT * FROM hovertree_union_1 2 MINUS 3 SELECT * FROM hovertree_union_2; ID VAL ---------- -------------------- 3 C SQL> SELECT * FROM hovertree_union_2 2 MINUS 3 SELECT * FROM hovertree_union_1; ID VAL ---------- -------------------- 4 D -- 何問起 hovertree.com
推薦:http://www.cnblogs.com/roucheng/p/3504463.html