>Hi everyone.
>
>I have two tables this way:
>
>Master : Primary key = Field1 + Field2
>
>Detail : Regular index = Field1 + Field2 (Just like Master-Primary key)
>
>I am trying to see how VFP get optimized queries and found this:
>
>Select * from detail where field1+field2 = master.field1 + master.field2.
>
>It is optimized (sys(3054,1)) and works very fast, but of course, it only takes one record from master table.
>
>Now, I want all records using 'inner join' and similar expressions:
>
>Select * from master inner join detail on ;
> master.field1 + master.field2 = detail.field1 + detail.field2
>
>Optimization: None.
>Why this statement is not optimized?
>
>Thanks.
>
>Juan Carlos
Without addressing your question, why are you using compound keys? In most cases you can link tables using a single field in each - an Integer field works well for this. Indexing, JOIN syntax and getting optimized queries become very easy.
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up