我有一个表easy_drinks
,其中包含2列drink_name
VARCHAR& second
VARCHAR。我希望将second
列中的数据不以A,B或C
SELECT drink_name, second FROM easy_drinks WHERE second NOT IN ('A%', 'B%', 'C%');
我可以使用BETWEEN运算符获得所需的结果---
SELECT drink_name, second FROM easy_drinks WHERE NOT second BETWEEN 'A%' AND 'D%';
但我想将它与NOT IN
运算符
答案 0 :(得分:2)
使用REGEXP
SELECT drink_name, second
FROM easy_drinks
WHERE second REGEXP ^[^ABC]
答案 1 :(得分:1)
使用In
与Like
不能使用此语法
SELECT drink_name, second FROM easy_drinks WHERE second NOT Like 'A%' and second NOT Like 'B%' and second NOT Like 'C%';