Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Optimise Select In Query

Author  Topic 

blinton25
Yak Posting Veteran

90 Posts

Posted - 2003-09-01 : 10:34:37
Hello,

How are you today?

select [KEY],F_NUMBER from [input table] Where [input table].F_NUMBER not in (select [Airline Codes].[VESSEL_FLIGHTID] from [Airline Codes])

Input table has 30583 records and Airline codes has 11784 records

This query is taking long to run (like minutes). I am using Access VB, and I figure that maybe if I can change the cursor type or optimise the query then it should help the speed.

Any suggestions?

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2003-09-01 : 11:27:49
If it's Access, I'd change the correlated subquery into a join.

SELECT IT.[KEY], IT.F_NUMBER
FROM [input table] AS IT
LEFT JOIN [Airline Codes] AS AC ON IT.F_NUMBER = AC.[VESSEL_FLIGHTID]
WHERE AC.[VESSEL_FLIGHTID] IS NULL
Go to Top of Page

blinton25
Yak Posting Veteran

90 Posts

Posted - 2003-09-01 : 13:14:32
Hello,

Thanks, the query is definitely running faster when I run it from an Access Query Window. Still not as fast from Access VB, so will continue to research what other issues may be involved.
Go to Top of Page
   

- Advertisement -