[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

MS Access query

Posted on 2013-05-29
4
Medium Priority
?
244 Views
Last Modified: 2013-05-31
Hi,

I would be very grateful if someone could help me with the following.

I have 2 tables that have the same number of records and some fields are the same.

I would like to produce a query that retrieves all the data from the 2nd table and adds the records for 2 fields from the 1st table.

Many thanks in advance
Alison
0
Comment
Question by:alisonthom
  • 2
  • 2
4 Comments
 
LVL 41

Accepted Solution

by:
Sharath earned 800 total points
ID: 39205837
Do you have a common column on which you can join two tables? You may need something like this.


SELECT Table2.*,Table1.Column1,Table1.Column2
  FROM (Table2
  INNER JOIN Table1 ON Table2.PK = Table1.PK)
0
 

Author Comment

by:alisonthom
ID: 39205923
Thank you for the quick response.

Yes, there is a common column in both tables.  Could you indicate how this would affect the SQL you have suggested?

Many thanks
Alison
0
 
LVL 41

Expert Comment

by:Sharath
ID: 39206153
Replace PK with the common column in the above sql
0
 

Author Closing Comment

by:alisonthom
ID: 39210506
Very sorry for the delay in replying.
Thanks so much for your help
Alison
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

872 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