简体   繁体   English

查询表达式中的Microsoft ODBC Excel驱动程序语法错误(缺少运算符)

[英]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.

相关问题 [Microsoft] [ODBC Microsoft Access驱动程序]查询表达式中的语法错误(缺少运算符) - [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 错误 [42000] [Microsoft][ODBC Excel 驱动程序] 语法错误(缺少运算符) - ERROR [42000] [Microsoft][ODBC Excel Driver] Syntax error (missing operator) odbc_exec():SQL错误:[Microsoft] [ODBC Microsoft Access驱动程序]语法错误(缺少运算符) - odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) 查询表达式中的SQL语法错误(缺少运算符) - SQL Syntax error (missing operator) in query expression 的查询表达式中的语法错误(缺少运算符) - Syntax error ( missing operator ) in query expression of 查询表达式中的语法错误(缺少运算符) - Syntax error (missing operator) in query expression 查询表达式中的语法错误(缺少运算符) - VBA - Syntax error (missing operator) in query expression - VBA sql 中的查询表达式中的语法错误(缺少运算符) - Syntax error (missing operator) in query expression in sql 查询表达式中的语法错误(缺少运算符) - Syntax error (missing operator) in query expression 查询表达式中的语法错误(缺少运算符) - Syntax Error (missing operator) in the query expression
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM