Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MS Access query

Posted on 2013-05-29
4
Medium Priority
?
242 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
[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
  • 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
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…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

636 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