PRSQL9103003: The ANY Keyword Does Not Return Expected Results

ID Number: Q70823

1.10

OS/2

buglist1.10

Summary:

PROBLEM ID: PRSQL9103003

SYMPTOMS

The ANY keyword does not return results as expected when using a

subquery that references another table.

CAUSE

The optimizer is not removing duplicates correctly.

RESOLUTION

Substitute SELECT (min) in the subquery. For example, change the

following query

SELECT loc, sum(cost) FROM test WHERE cost > ANY (SELECT b FROM t1)

GROUP BY loc

to:

SELECT loc, sum(cost) FROM test WHERE cost > (SELECT min(b) FROM t1)

GROUP BY loc