访问查询条件,其中字段不包含数字

时间:2015-01-16 13:48:58

标签: sql ms-access ms-access-2007

我想制作一个不相同的查询条件%Any Number%这包括数值以及包含数字的任何字符串。现在我用这个作为我的表达。它有效,但我想简化我的代码。

SELECT Distinct tblProductionTime.production_order_number
FROM tblProductionTime
GROUP BY tblProductionTime.production_order_number
HAVING (((tblProductionTime.production_order_number) Not ALike "%0%" And
(tblProductionTime.production_order_number) Not ALike "%1%" And
(tblProductionTime.production_order_number) Not ALike "%2%" And
(tblProductionTime.production_order_number) Not ALike "%3%" And
(tblProductionTime.production_order_number) Not ALike "%4%" And
(tblProductionTime.production_order_number) Not ALike "%5%" And
(tblProductionTime.production_order_number) Not ALike "%6%" And
(tblProductionTime.production_order_number) Not ALike "%7%" And
(tblProductionTime.production_order_number) Not ALike "%8%" And
(tblProductionTime.production_order_number) Not ALike "%9%"));

1 个答案:

答案 0 :(得分:4)

怎么样:

Not ALike "%[0-9]%"

这将捕获包含0到9之间任何数值的字段/列。