开发者

Can I use an "IN" filter on an Advantage Database Table (TAdsTable)?

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 r开发者_运维百科epeat 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'


It is possible to use the INLIST function for this. That function exists for Visual FoxPro compatibility. It would look like:

Filter := 'InList(FieldName, 1, 2, 3)';

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.


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 and Advantage 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜