[英]“Data type mismatch in criteria expression” when doing SQL subquery in Access 2010
Here is my simplified code (little more than some basic elements to cause the SQL not to execute): 这是我的简化代码(除了使SQL无法执行的一些基本元素之外):
select *
from (
select replace(mytxtfield, "llama", "") as badones
from XYZ
)
where badones is not null;
The outer query runs fine when the WHERE cause is: 当WHERE原因是时,外部查询运行良好:
badones like "ZZZ-[0-9][0-9][0-9]"
but it breaks when the WHERE cause includes more than one LIKE (of any digit matching pattern) such as: 但是当WHERE原因包含多个(任何数字匹配模式的)LIKE时,它将中断,例如:
badones like "ZZZ-[0-9][0-9]" OR
badones like "ZZZ-[0-9][0-9][0-9]"
More info: 更多信息:
Since your sub-query returns the alias "badnews", you must use it in place of "badones" in your outer query. 由于子查询返回别名“ badnews”,因此您必须在外部查询中使用它代替“ badones”。 The following produces no errors:
以下不会产生任何错误:
SELECT *
FROM (select replace(mytxtfield, "llama", "") as badnews
from XYZ
)
WHERE (((badnews) Like "ZZZ-[0-9][0-9]" Or (badnews) Like "ZZZ-[0-9][0-9][0-9]"));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.