Selasa, 28 April 2015

Re: [MS_AccessPros] NOT IN condition

 

Phucon-


It would be better to be table-driven.  Furthermore, Access solves NOT IN conditions very slowly.  After you have the numbers in a table, it would be better to use an OUTER JOIN like this:

FROM Accounts LEFT JOIN
ztblNotAccounts
ON Accounts.AcctNumber = ztblNotAccounts.AcctNumber
WHERE ztblNotAccounts.AcctNumber IS NULL

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Apr 28, 2015, at 5:15 PM, saigonf7q5@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

Inside the NOT IN condition of the WHERE clause of the production database contains like 200 'AcctNumber'. e.g. NOT IN('1','2','3','4','5'.... and more).

 

I am wondering if there is a better way to code it, like, create a separate table instead of place the AcctNumber in side the parenthesis?

 

Phucon


__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

.

__,_._,___

Tidak ada komentar:

Posting Komentar