Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Select
Message
De
10/07/2012 09:28:01
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01547863
Message ID:
01548014
Vues:
51
>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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform