[英]Microsoft ODBC Excel Driver Syntax Error (missing operator) in query expression
I am using XL Report Builder version 2.1.4 and trying to execute the following script but, keep getting the error "Microsoft ODBC Excel Driver Syntax Error (missing operator) in query expression". 我使用的是XL Report Builder 2.1.4版,并尝试执行以下脚本,但始终收到错误“查询表达式中的Microsoft ODBC Excel驱动程序语法错误(缺少运算符)”。
select Bidders.*
From Bidders
where
If :Param1 = 1 Then
Due > 0 and
Left(Event,2) <> 12
Else
Due = 0 and
Left(Event,2) <> 12
End If
order by
Name
Param1
is a user-entry parameter that can be either "0" or "1". Param1
是用户输入参数,可以为“ 0”或“ 1”。 Does anyone have any advice as to what operator I am missing? 有人对我缺少什么操作员有任何建议吗?
The if
in the query looks suspicious. 查询中的
if
可疑。 Try writing the query as: 尝试将查询编写为:
select Bidders.*
From Bidders
where (:Param1 = 1 and Due > 0 and Left(Event,2) <> 12) or
(:Param1 <> 1 and Due = 0 and Left(Event,2) <> 12)
order by Name;
You can simplify this as: 您可以将其简化为:
select Bidders.*
From Bidders
where Event not like '12%' and
((:Param1 = 1 and Due > 0) or
(:Param1 <> 1 and Due = 0)
)
order by Name;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.