I have designed a form to bridge one customer record with a master customer record in a table. For example:
CustomerName, CustomerNumber:
ABC Company, 101;
ABC Corp. , 102;
ABC Inc., 103;
ABC Co., 104;
ABC Comp., 105;
MasterCustomerN ame, MasterCustomerN um:
ABC Master, 1001
Bridge:
101, 1001;
102, 1001;
103, 1001;
104, 1001;
105, 1001
To give me the customers that have not yet been assigned to a Master Record, I wrote query that looks at a table and finds all customer numbers that are not in the Bridge table:
tblX has approx 500,000 records and it is taking about 10 to 12 seconds to run the query. I have to refresh the query every time I use the form to update the Bridge Table.
Any advice on how to speed up the runtime of the query?
Thanks in advance,
bplantes
CustomerName, CustomerNumber:
ABC Company, 101;
ABC Corp. , 102;
ABC Inc., 103;
ABC Co., 104;
ABC Comp., 105;
MasterCustomerN ame, MasterCustomerN um:
ABC Master, 1001
Bridge:
101, 1001;
102, 1001;
103, 1001;
104, 1001;
105, 1001
To give me the customers that have not yet been assigned to a Master Record, I wrote query that looks at a table and finds all customer numbers that are not in the Bridge table:
Code:
"SELECT DISTINCT CUSTOMER_NBR, CUSTOMER_NAME FROM tblX WHERE NOT Exists (SELECT BridgeCustomerNumber, From tblCustomerBridge WHERE BridgeCustomerNumber = CUSTOMER_NBR) ORDER BY CUSTOMER_NAME;"
Any advice on how to speed up the runtime of the query?
Thanks in advance,
bplantes
Comment