Prevent Oracle minus statement from removing duplicates

前端 未结 7 1174
被撕碎了的回忆
被撕碎了的回忆 2021-02-15 19:13

Given these two tables:

CREATE TABLE TEST1 (TEST  VARCHAR2(1 BYTE))
CREATE TABLE TEST2 (TEST  VARCHAR2(1 BYTE))

Where TEST1 has two rows both w

7条回答
  •  一整个雨季
    2021-02-15 19:44

    Part of what minus does is removes duplicates. Consider using NOT IN to avoid removing duplicates.

    SELECT TEST FROM TEST1 WHERE TEST NOT IN(SELECT TEST FROM TEST2)
    

提交回复
热议问题