Solved

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

Posted on 2011-02-23
2
257 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

789 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