Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unoptimized SQL SELECT statement

Status
Not open for further replies.

andrej67

IS-IT--Management
Jan 23, 2007
14
SI
Hi,

i'm having troubles getting data from a master-detail related tables when a new detail is added and index in VFP detail or master table isn't updated yet (why is another story).

select m.master, m.detail, d.detail_data
from md_master m
inner join md_detail d
where m.master = XX and m.detail = d.detail

Is there a way to do (according to VFP help the answer is NO) something like NOOPTIMIZE with LOCATE, since unoptimized LOCATE finds the new detail in md_detail or md_master table and SELECT statement doesn't? Opening and closing tables does not help and updateing (which refreshes the indexes) is not an option since both tables are strictly opened readonly.

Thanks in advance,
Andrej
 
Code:
SET OPTIMIZE OFF
QUERY HERE
SET OPTIMIZE ON

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Borislav, unfortunately, setting optimize on or off doesn't help either since SQL statement isn't considered "FOR supported". I've tried this in the start, but to no avail. If only i could use SELECT ... NOOPTIMIZE ...
 
Oh well, i think i've found the answer. All i have to do is put upper (or whatever that isn't in the index eexpresion of the table) in where criteria (so that it doesn't get recognized as part of the index) and i get the expected results.
Case closed. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top