ID: Q118491
The information in this article applies to:
The SELECT-SQL command does not honor a filter condition that was established with the SET FILTER command.
The SELECT-SQL command operates directly against the specified tables and is therefore not influenced by the existence of a filter condition.
Instead of using SET FILTER to exclude a set of records, use the WHERE clause of the SELECT-SQL command to exclude a set of records.
The following example illustrates the behavior and the resolution:
* Create a sample table
CREATE TABLE test (one C(2))
INSERT INTO test (one) VALUES ("AA")
INSERT INTO test (one) VALUES ("BB")
INSERT INTO test (one) VALUES ("BB")
INSERT INTO test (one) VALUES ("CC")
* Establish a filter to exclude all "BB" records
SET FILTER TO one <> "BB"
* Show the results of the filter:
LIST
* The following SELECT statement ignore the
* filter, it will retrieve all records:
SELECT * FROM test
* Instead of using the filter, exclude all "BB" records using
* the WHERE clause of the SELECT command:
SELECT * FROM test WHERE one <> "BB"
This behavior is by design.
The "SET FILTER" topic in the online Help file states that the SET FILTER command "specifies a condition that records in the current table/.DBF must meet to be accessible." The Help entry further states that "All commands that access the table/.DBF respect the SET FILTER condition."
These statements are accurate for all commands except the SELECT-SQL command. The SELECT-SQL command does not honor a filter condition established with the SET FILTER command.
Additional reference words: FoxMac FoxDos FoxWin 2.00 2.50 2.50a 2.50b 2.60 docerr KBCategory: kbprg kbprb kbdocerr KBSubcategory: FxprgSql
Last Reviewed: June 27, 1995