DISTINCT elimination in IN, ANY, and EXISTS subqueriesAn IN, ANY, or EXISTS subquery evaluates to true if there is at least
one row that causes the subquery to evaluate to true. These semantics make a
DISTINCT within an IN, ANY, or EXISTS subquery unnecessary.Subquerieselimination of DISTINCT in IN,
ANY, and EXISTS subqueries
The following two queries are equivalent, and the first is transformed into
the second:
SELECT * FROM t1 WHERE c1 IN
(SELECT DISTINCT c2 FROM t2 WHERE t1.c3 = t2.c4)
SELECT * FROM t1 WHERE c1 IN
(SELECT c2 FROM t2 WHERE t1.c3 = t2.c4)