Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to merge two tables on access

Posted on 2008-10-12
3
Medium Priority
?
1,600 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 2000 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

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.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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.

715 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