Solved

Is there a more efficient way to write the following SQL statement?

Posted on 2011-02-23
2
255 Views
Last Modified: 2012-05-11
I am developing an Access applicatiion using Access 2003 with an MDB type file.

I have a SQL statement that is running inefficiently as follows:

update tblBanks
inner join tblBanksReptNameCurr
On tblBanks.RptID=tblBanksReptNameCurr.[RPT ID]
set tblBanks.[SENIOR MANAGEMENT TAB] = tblBanksReptNameCurr.[SENIOR MANAGEMENT TAB]  AND
tblBanks.CURRENCY = tblBanksReptNameCurr.CURRENCY

Is there a better way to create this SQL statement?
0
Comment
Question by:zimmer9
2 Comments
 
LVL 14

Expert Comment

by:Bill Ross
ID: 34961274
Hi,

SQL is fine but you should make sure you have indexes set on fields tblBanks.RptID and tblBanksReptNameCurr.[RPT ID] and make sure both thable have primary keys.
Also, save the SQL statement as a query and run the query.

That should speed it up.

Regards,

Bill
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 34961309
i wonder if you were able to run the update query that you have...

you don't need the "AND" on this line

set tblBanks.[SENIOR MANAGEMENT TAB] = tblBanksReptNameCurr.[SENIOR MANAGEMENT TAB] AND
tblBanks.CURRENCY = tblBanksReptNameCurr.CURRENCY



update tblBanks
inner join tblBanksReptNameCurr
On tblBanks.RptID=tblBanksReptNameCurr.[RPT ID]
set tblBanks.[SENIOR MANAGEMENT TAB] = tblBanksReptNameCurr.[SENIOR MANAGEMENT TAB] ,
tblBanks.CURRENCY = tblBanksReptNameCurr.CURRENCY


0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now