I'm trying to use the NOT
operator with ALL
but does not compare as it should
I followed the following:
tablex contains for example:
+------+------+
| id | name |
+------+------+
| 6 | a |
| 7 | b |
| 8 | c |
| 9 | d |
| 10 | e |
+------+------+
5 rows in set (0.04 sec)
and tabley contains:
+------+------+
| id | name |
+------+------+
| 4 | a |
| 5 | b |
| 7 | c |
| 8 | d |
+------+------+
4 rows in set (0.03 sec)
i've used:
SELECT id, name FROM tablex WHERE NOT id < ALL (SELECT id FROM tabley);
returns:
+------+------+
| id | name |
+------+------+
| 6 | a |
| 7 | b |
| 8 | c |
| 9 | d |
| 10 | e |
+------+------+
5 rows in set (0.00 sec)
the problem is that returns lower values than those of 'tabley' in some cases,
It is very logical the solution using the operator >
, but what is this about?
SELECT id, name FROM tablex WHERE NOT id < ANY (SELECT id FROM tabley);
returns:+------+------+ | id | name | +------+------+ | 8 | c | | 9 | d | | 10 | e | +------+------+ 3 rows in set (0.11 sec)
why works with 'ANY' but no with 'ALL'? – MindLerp Apr 02 '16 at 22:09