我可以使用“IN”吗?对 Advantage 数据库表 (TAdsTable) 进行过滤?
我想使用整数字段的多个值将过滤器应用于优势表。
等效的 SQL 是:
SELECT * FROM TableName WHERE FieldName IN (1, 2, 3)
是否可以在 AdsTable 上执行相同的操作,而必须使用“OR”重复该字段?
我想要类似的东西:
Filter := 'FieldName IN (1, 2, 3)'
而不是:
Filter := 'FieldName = 1 OR FieldName = 2 OR FieldName = 3'
I want to apply a filter to an advantage table using multiple values for an Integer field.
The equivalent SQL would be:
SELECT * FROM TableName WHERE FieldName IN (1, 2, 3)
Is it possible to do the same on an AdsTable within having to repeat the field using an "OR"?
I want to something like:
Filter := 'FieldName IN (1, 2, 3)'
Instead of:
Filter := 'FieldName = 1 OR FieldName = 2 OR FieldName = 3'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为此可以使用
INLIST
函数。该函数的存在是为了与 Visual FoxPro 兼容。它看起来像:但是,我不认为它目前已针对使用索引进行了优化。因此,如果表非常大,则使用
FieldName = 1 OR FieldName = 2 ...
版本的过滤器会更有效。It is possible to use the
INLIST
function for this. That function exists for Visual FoxPro compatibility. It would look like:However, I do not believe that it is currently optimized to use an index. So if the table is very large, it will be much more efficient to use the
FieldName = 1 OR FieldName = 2 ...
version of the filter.IN
语法仅适用于 SQL,不适用于过滤器和索引中使用的表达式引擎。正如马克已经建议的那样,我将使用
FieldName = 1 OR FieldName = 2 ...
语法。有关
Advantage 表达式引擎
和Advantage 优化过滤器
的更多信息,请参阅帮助:http://devzone.advantagedatabase.com/dz/WebHelp/Advantage10.1/master_advantage_expression_engine.htm
http://devzone.advantagedatabase.com/dz/WebHelp/Advantage10.1/master_advantage_optimized_filters.htm
The
IN
syntax only works for the SQL, not for the expression engine which is used in filters and indexes.As already suggested by Mark I would use the
FieldName = 1 OR FieldName = 2 ...
syntax.More information on the
Advantage Expression Engine
andAdvantage Optimized filters
is in the help:http://devzone.advantagedatabase.com/dz/WebHelp/Advantage10.1/master_advantage_expression_engine.htm
http://devzone.advantagedatabase.com/dz/WebHelp/Advantage10.1/master_advantage_optimized_filters.htm