Ett annat alternativ:
SELECT TEST, row_number() OVER (PARTITION BY TEST ORDER BY TEST) FROM TEST1
MINUS
SELECT TEST, row_number() OVER (PARTITION BY TEST ORDER BY TEST) FROM TEST2
Detta skulle vara MINUS med varje dubblett som behandlas som en distinkt post. Observera i exemplet nedan att om TEST1 har två 'C'-värden och TEST2 bara har ett, får du ett i utgången.
dev> select * from test1;
T
-
A
A
B
C
C
dev> select * from test2;
T
-
B
C
dev> SELECT TEST, row_number() OVER (PARTITION BY TEST ORDER BY TEST) FROM TEST1
2 MINUS
3 SELECT TEST, row_number() OVER (PARTITION BY TEST ORDER BY TEST) FROM TEST2
4 /
T ROW_NUMBER()OVER(PARTITIONBYTESTORDERBYTEST)
- --------------------------------------------
A 1
A 2
C 2