Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A question about SELECT SQL?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00424948
Message ID:
00425121
Vues:
20
>Put your data in the array in String
>P.e
>cString=""
>For i=1 to alen(cArray)
> cString=cString+cArray(i)+","
>endfor
>cString=Left(len(cString)-1) && supress the las ","
>cWhere="Inlist("+companyName+","+cString+")"
>Selec * from my table &cWhere

Juan,

First of all, INLIST function is limited to 24 elements according to DOC.

Secondly, you have to surround each code with quotation, e.g.
for i=1 to alen(myArray)
    cString=cString+'"'+myArray[i]+'",'
next
Anyway, Sergey and Houston already gave the correct and better syntax.

Another idea, similar to Sergey's, but according to my tests should run faster:
1) Put array into a temprorary table (or cursor) myTempTable (all companies in upper case), index this table by CompanyName

2) select * from MainTable inner join myTempTable on upper(MainTable.CompanyName)=myTempTable.CompanyName

MainTable should have an index on upper(CompanyName)
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform