Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
2 level SQL
Message
 
 
To
15/05/2008 19:06:12
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01317489
Message ID:
01317506
Views:
10
>>>Wow. That's even shorter than Naomi's solution. I don't see anything about the IN in the VFP help. Is it documented anywhere?
>>>
>>>
>>It's a standard SQL. What do you see at Select-SQL command in Help? I think it is probably documented there.
>
>Unless I'm blind (which is almost true) there's no mention of IN in the VFP docs.

Ok, I had to check it myself
See Filter & Conditions

Copy Code
CLOSE ALL
CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\TestData')
SELECT TAlias1.company, TAlias2.order_date ;
FROM customer TAlias1, orders TAlias2 ;
WHERE TAlias1.cust_id = TAlias2.cust_id ;
AND TAlias2.order_date < {^1994-02-16}

Filter Options and Values
You can use filter options in addition to comparison operators so you can customize your filter condition to choose subsets of records. When using these options, the syntax of the filter condition can be one of the following:

FieldName Comparison Expression | ALL (Subquery) | ANY (Subquery) | SOME (Subquery)

-OR-

FieldName [NOT] LIKE cExpression | IS [NOT] NULL | [NOT] BETWEEN Start_Range AND End_Range | [NOT] IN Value_Set | [NOT] IN (Subquery)

-OR-

[NOT] EXISTS (Subquery)

The following table describes options available for filter conditions.

Option Description
ALL (Subquery)
FieldName values must meet comparison for all values generated by the subquery for inclusion in the query results.

ANY (Subquery) | SOME (Subquery)
FieldName values must meet comparison for at least one of the values generated by the subquery for inclusion in the query results.

LIKE "cExpression"
FieldName values must match the character expression cExpression, which can contain SQL wildcard characters, such as percent (%) and underscore (_), for inclusion in the query results.

The % character represents any sequence of unknown characters in the string. The _ character represents a single unknown character in the string. If you want to specify a wildcard character as a literal, use the ESCAPE clause. For more information, see Wildcard Characters in Filter Conditions below.

The LIKE "cExpression%" filter condition is fully optimized.

IS NULL
FieldName value must be null for inclusion in the query results.

BETWEEN Start_Range AND End_Range
FieldName values must be within a specified range of values for inclusion in the query results.

IN (Value_Set)
FieldName must contain one of the values or expressions specified in Value_Set for inclusion in the query results. When listing items in the value set, separate each item with commas.

Note
The number of values or expressions you can specify for Value_Set is affected by the setting of SYS(3055) - FOR and WHERE Clause Complexity.

Tip
Visual FoxPro stops evaluating values and expressions in the Value_Set list when the first match is found. Therefore, if the IN clause is not Rushmore optimized, you can improve performance by placing values most likely to match in the beginning of the Value_Set list.


IN (Subquery)
FieldName must contain one of the values returned by Subquery for inclusion in the query results.

EXISTS (Subquery)
Query contains results only when at least one row is returned from the subquery. The EXISTS clause evaluates to True (.T.) or False (.F.).

Note
The EXISTS (Subquery) clause evaluates to True (.T.) unless the subquery evaluates to the empty set.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform