SQL: SOME and ANY operators in SQL Server T-SQL

SQL: SOME and ANY operators in SQL Server T-SQL

I recently wrote about the ALL operator in T-SQL. It’s used to check how a given value compares to a list of values. That list generally comes from a sub-query that returns a single column. While the ALL operator isn’t well known, there are also other related operators SOME and ANY.

SOME and ANY are synonyms. You can use either.

Instead of returning whether or not all the values in a list meet the logical operation, these return whether any of the values in the list meet the requirement.

I’ve changed the query that I previous used for ALL, to now use SOME. So instead of working out the oldest order where we can supply all items, it finds the oldest order where we can supply some of the items.

2021-03-05