?
Solved

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

Posted on 2011-02-23
2
Medium Priority
?
264 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

719 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