Skip to content

ANY

Define a comparison condition that returns true when the comparison is true for at least one value returned by a subquery. This kind of condition is synonymous with the IN condition.

ANY | SOME (subquery)

where subquery returns one column with 0 or more rows. ANY and SOME are synonyms.

For example:

premdb=# SELECT seasonid FROM season 
WHERE seasonid=ANY(SELECT seasonid FROM match);
 seasonid 
----------
       1
       2
       3
       4
       5
       6
       7
       8
       9
...

This query is equivalent to:

SELECT seasonid FROM season 
WHERE seasonid IN(SELECT seasonid FROM match);

Parent topic:SQL Conditions