Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Improving sluggish SQL
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00306158
Message ID:
00306182
Views:
28
Hi Bruce,

Try:

- Not use SELECT *
Do like this: SELECT keyfield ....

Check out results!

- OR do the follwing:

SELECT keyfield from table1 into array1
SELECT keyfield from table2 into array2

LinesNumber1 = Alen(array1, 1)
LinesNumber2 = Alen(array2, 1)

Dimension NewArray(LinesNumber1, 1)
k = 0
For i = 1 to LinesNumber1
For j = 1 to LinesNumber2
FindTopic = Ascan(array1, array2(j))
If FindTopic > 0
k = k + 1
NewArray(k)= FindTopic
* Or create a string
strFind = strFind + array1(FindTopic) + ","
Endif
Next j
Next i
* At the array NEWARRAY you have your result,
* now you can make the query again to retrieve the date you want.
* or you can use the string, and associate to a SQL statement using IN
strFind = Substr(strFind, 1, Len(strFind)-1) && Take off the last comma
Select * from table1
where keyfield in (strFind)

That should handle! Check results! Say something, OK?

Cheers,

Ricardo
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform