Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Not optimized
Message
 
 
To
15/02/2010 14:24:25
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01449210
Message ID:
01449221
Views:
47
>>>>The following is very slow, presumably because of my use of IN
Select * From KTrackTagDetail							;
>>>>	where (Seqno In (Select Seqno From C_Kits)			;
>>>>	or SeqnoFG In (Select Seqno From C_Kits))			;
>>>>	and Left (RecordType,2) # 'AP'						;
>>>>	into Cursor C_Detail
>>>>So, how can I speed this up?
>>>>
>>>>Thanks
>>>
>>>
>>>Try ONE left join insstead of two select queries
>>>
>>>
>>>Select * From KTrackTagDetail ;
>>>	left join C_Kits on (  KTrackTagDetail.Seqno ==  C_Kits.Seqno ) ;
>>>		or    (  KTrackTagDetail.SeqnoFG ==  C_Kits.Seqno ) ;
>>>	where (  Left (RecordType,2) # 'AP' ) ;
>>>	    and ( C_Kits.Seqno is not null )
>>>
>>
>>LEFT JOIN is not the same as IN condition. This is not equavalent to the original query.
>
>Who cares - it'll probably run faster - with the same results

See answer from Boris - it will not return the same number of records if you have One to Many relationship between these two tables.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform