Hi DaveMac,
I have gotten some really strange results when performing queries against a VFP table, especially where the query was not properly constructed, the tables were not indexed, and there were no common fields between the table upon which to build a relationship.
You might try reorganizing your tables better, and setting up some indexes on the fields you are likely to query. In order to get rushmore optimization you will need to construct your SQL so it exactly matches the way the index is built per the index command. Also, be sure to include a common fields in both tables so that you can establish proper relationships. Are your tables setup in a one to one relation, one to many relation, or many to many relation?
If the relation was one to many and there was a primary key in a parent table that matched a key in the child table, and you had indexes on both tables based on this key, it should speed up your queries greatly.
So, if you wanted to grab transactions based on the day they occurred, you should have a date field in both tables and both tables should have an index on the date field.
Then you could set a relation from table1 into table2 based on the date field. Then when you make a query that involves selecting fields from both tables you could do something like the following in your SQL clause:
Select table1.field1, table1.field2,table2.field1,+;
table2.field2+;
FROM table1 INNER JOIN table2 "+;
ON table1.date = table2.date+;
WHERE (table2.date = XXXXXXXXX+;
order by table1.field1 into cursor your_query
Sorry about the multiple posts, but I'm having one of those day where I'm having difficulty with everything. I was notified by the program that it had timed out, but evidently the posts when through, but before I had a chance to check them.
Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox