?
Solved

Inner join and update statement in Access

Posted on 2009-05-11
2
Medium Priority
?
505 Views
Last Modified: 2012-05-06

I saw below SQL statement in an Access project:
  db.Execute "UPDATE tableA INNER JOIN tableB" _
               & "ON tableA.NUMBER = tableB.Number_ASC" _
               & "Set tableA.field1 = tableB.field1
            ...

I don't have much experience in Access, could anyone explain this query? Is it a common practice in Access? BTW, I know inner join, but am just not used to the usage of the update statement here. Thanks.

 
0
Comment
Question by:heyday2004
[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 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1600 total points
ID: 24352281
that UPDATE does a update of tableA, if there are matching rows in tableB, based on the join, and assigns the value of field1 of tableb for the matching row to tableA.field1.

and yes, this is common practice in access.
0
 
LVL 44

Assisted Solution

by:GRayL
GRayL earned 400 total points
ID: 24354953
It will only be an updatable query if the fields in the ON clause are primary keys (no duplicates).  If there was ever an instance where there were two or more records from tableB matching the tableA join, the update would fail.
0

Featured Post

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
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…
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…
Suggested Courses

741 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