Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A question about SELECT SQL?
Message
From
04/10/2000 16:44:14
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00424948
Message ID:
00425015
Views:
17
>>>>>>Can you build a WHERE CLAUSE using an array in a SELECT statement? I have a table with a field called company_names. I need to code a SELECT statement with a WHERE CLAUSE that pulls out all the records that are in my array... example...SELECT * FROM master_table WHERE company_name =(all the elements in my array) INTO mycirsor...
>>>>>>This should give me a cursor with all company_names that are in my array...any ideas?
>>>>>
>>>>>SELECT * FROM master_table WHERE ASCAN( aCompanyNames, company_name ) # 0
>>>>>
>>>>>This assumes that you are not too worried about optimization, that capitalisation is not an issue, etc.
>>>>Hi Houston:
>>>>my code is...
>>>>select company_name from mymaster where ascan(myarray)
>>>>This is not working...
>>>>
>>>>I need my array called myarray to be used in the WHERE CLAUSE.
>>>
>>>For aCompanyNames read myarray - if you are using myarray as a variable name you are in the wrong occupation - IMO!
>>Hi Houston, I am not using aCompanyNames as a variable name. I am using
>>an array with myarray[1],myarray[2].myarray[3],etc...
>
>In the VFP command window type ASCAN() highlight it and press F1 - you will see that this function takes more than one parameter - the first one is the array that you want to search in, the second is the item to compare each entry in the array against, there are optional additional parameters, but I will let you discover these your yourself.
>
>So, select company_name from mymaster where ascan(myarray) is not quite there.
>You need to use:
>SELECT * FROM master_table WHERE ASCAN( MyArray, company_name ) # 0
yes, I understand and it works using - SELECT * FROM master_table WHERE ASCAN( MyArray, company_name ) # 0....:) thanks ...:))))
Robert Keith
Independent Developer
San Antonio, Texas
E-mail address:
rebelrob1@yahoo.com
Previous
Reply
Map
View

Click here to load this message in the networking platform