Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select
Message
From
10/07/2012 09:28:01
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01547863
Message ID:
01548014
Views:
50
>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 thing that comes to mind is that, if you have three fields with the same type of information, you might be better off storing the information in a single field, and in separate records (perhaps in another table). This is basic data normalization, but of course, I don't know exactly what information your fields hold.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform