Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01547863
Message ID:
01547873
Views:
56
>>Hi,
>>
>>I have a case where I need to select records when one of three integer fields equals to some set value. For example, say table has fields Fld1 (Int), Fld2 (int), Fld3 (int). I want to find all records where a one of the fields has value nNumber. So the way I could do it as:
>>
>>
>>select * from MyTable where Fld1 = nNumber or Fld2 = nNumber or Fld3 = nNumber
>>
>>
>>Is there a faster approach that would hopefully work in both VFP and SQL Server? Note that the table has an index on Fld1, and Fld2, and Fld3.
>>
>>TIA.
>
>One alternative (just a shorter syntax):
>
>
>select * from myTable where nNumber IN (Fld1, Fld2, Fld3).
>
>
>They will behave the same as your original code, just a shorter code.
>
>There is no faster approach for this problem.

Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform