带有多个逻辑运算符的 SQL 语句
我需要在其中运行 SQL 查询 -current_queue不等于i01并且不以F开头 -prod_code 以 R 开头
SQL = "SELECT " & Join(theseFields, ",") & " FROM [Acct Detail$] WHERE NOT (current_queue='I01' OR LEFT(current_queue,1)='F')"
这对我来说可以删除 i01 和以 F 开头的队列,但现在如何过滤掉不以 R 开头的 prod_code ?
(这是 ADODB、VBA、Excel、Microsoft.Jet.OLEDB.4.0)
I need to run a SQL query where
-current_queue does not equal i01 and does not start with F
-prod_code starts with R
SQL = "SELECT " & Join(theseFields, ",") & " FROM [Acct Detail$] WHERE NOT (current_queue='I01' OR LEFT(current_queue,1)='F')"
That works for me to remove i01 and queues starting with F but now how do I filter out prod_code that doesn't start with R?
(this is ADODB, VBA, Excel, Microsoft.Jet.OLEDB.4.0)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能会遇到 Excel 大小写敏感的问题:
如果这是 Access,您还必须检查 Null,但这似乎不是 Excel 的问题。
You can run into case sensitivity with Excel :
If this were Access you would also have to check for Null, but it does not seem to be a problem with Excel.
没关系,我决定这样做:
仍然好奇如何保持 prod_code 以 R 开头,但不是 i01 的 current_queue 或以 F 开头
Nevermind, I decided to go with this:
Still curious how to keep prod_code starting with R but not current_queue of i01 or starting with F
为了清晰起见,分成几行,这些应该在一行上
Split into lines for clarity, these should be on one single line