Solved

How to merge two tables on access

Posted on 2008-10-12
3
1,585 Views
Last Modified: 2012-05-05
Hello Experts,
I am in the process of analyzing the customer base against the salary amounts.  I have the following  
Table one
Cust ID      Salary
4556      500
4321      600
4566      100
123      999
1234      456

Table two
Cust ID      Salary
4556      399
54545      999
4566      5000
123456      500
4321      444


I need to have one table that has all the data.  Please note that not all customers in table 1 are in table two and not all customers in table 2 are in table 1.
Therefore I am having a problem joining these two tables.
I would like to have the following
Cust ID      Salary1      Salary2

Where if for example customer 4321 salary in table1 is 600 but  he is not in table 2 so value of zero should be assigned in the new table im trying to create
Thanks
0
Comment
Question by:dina78
[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
3 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 22700619
Create Query1 and save it.

Select custid from table1
Union
Select Custid from table2

Create query2:

Select query1.*, table1.salary as salary1, table2.salary as salary2
from (query1 left join table1 on query1.custid = table1.custid)
left join table2 on query1.custid = table2.custid
0
 
LVL 1

Expert Comment

by:rehan_k99
ID: 22700822
select distinct custid, table1.salary, table2.salary from table1, table2
0
 

Author Closing Comment

by:dina78
ID: 31407106
perfect solution thanks alot
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

739 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