Using MS Access/MS Access query part II

Advertisement


Question
Thanks Scott for your previous answer - I had actually figured that out after posting the question to you.

The query below hangs up on access - I am guessing due to records size
SELECT ICMS_PSTN.CUSTOMER_NUMBER
FROM (ICMS_PSTN LEFT JOIN SIEBEL_PSTN ON ICMS_PSTN.CUSTOMER_NUMBER = SIEBEL_PSTN.CUSTOMER_NUMBER) LEFT JOIN ICMS_PSTN_EXCLUDE_CUST_NUMBER ON SIEBEL_PSTN.CUSTOMER_NUMBER = ICMS_PSTN_EXCLUDE_CUST_NUMBER.CUSTOMER_NUMBER
WHERE (((ICMS_PSTN.CUSTOMER_NUMBER) Not In (SELECT ICMS_PSTN_EXCLUDE_CUST_NUMBER.CUSTOMER_NUMBER from ICMS_PSTN_EXCLUDE_CUST_NUMBER)) AND ((SIEBEL_PSTN.CUSTOMER_NUMBER) Is Null));

I have

Indexed the customer_number column in all 3 tables
Tried to run a query on a linked DB but same result

I have tried the same query on oracle express DB (same record count) and it runs absolutely fine (within seconds) - At work we have just shifted onto windows 7 and don't get admin rights any more :( hence cant install an oracle database. Access is the easiest option and is working for most of my easy queries (lesser records).

Any help or advice would be much appreciated.

Answer
Pull ICMS_PSTN_EXCLUDE_CUST_NUMBER out of the query. There is no reason to include it. The subquery will exclude the records you don't want.

Hope this helps,
Scott<>
Blog: http://scottgem.wordpress.com
Website: http://www.diamondassoc.com
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA

Using MS Access

All Answers


Answers by Expert:


Ask Experts

Volunteer


Scottgem

Expertise

I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience

I've been designing databases for over 25 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

Education/Credentials
Brooklyn College BA

©2016 About.com. All rights reserved.