ALL:
Result Value
Returns TRUE when the comparison specified is TRUE for** all pairs** (scalar_expression,x), when x is a value in the single-column set. Otherwise returns FALSE.
SOME | ANY:
SOME or ANY returns TRUE when the comparison specified is TRUE for **any pair **(scalar_expression,x) where x is a value in the single-column set; otherwise, returns FALSE.
Nawet przykład jest:
CREATE TABLE T1
(ID INT) ;
GO
INSERT T1 VALUES (1) ;
INSERT T1 VALUES (2) ;
INSERT T1 VALUES (3) ;
INSERT T1 VALUES (4) ;
The following query returns TRUE because 3 is less than some of the values in the table.
IF 3 < SOME (SELECT ID FROM T1)
PRINT 'TRUE'
ELSE
PRINT 'FALSE' ;
The following query returns FALSE because 3 isn't less than all of the values in the table.
IF 3 < ALL (SELECT ID FROM T1)
PRINT 'TRUE'
ELSE
PRINT 'FALSE' ;