?
Solved

Access table union - merge data even even non-matches other criteria

Posted on 2014-09-16
1
Medium Priority
?
318 Views
Last Modified: 2014-09-17
I have two tables, "GDW" and "JJHCC" that have the same fields -- User ID and Job Level

I want to create Union by User ID of both tables but I want to use the JJHCC values for Job Level if it exists and only use the GDW information if JJHCC is blank or if that User ID doesn't exist in JJHCC.

GDW has a lot more records than JJHCC so there will be a many that get brought over in the union.

What would the SQL look like for this?

Thanks for your help.

Adam
0
Comment
Question by:aehrenwo
[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
1 Comment
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 2000 total points
ID: 40325100
SELECT GDW.[User ID], Nz([JJHCC].[Job Level],[GDW].[Job Level]) AS [Job Level]
FROM GDW LEFT JOIN JJHCC ON GDW.[User ID] = JJHCC.[User ID]

UNION ALL

SELECT JJHCC.[User ID], JJHCC.[Job Level]
FROM GDW RIGHT JOIN JJHCC ON GDW.[User ID] = JJHCC.[User ID]
WHERE (((GDW.[User ID]) Is Null));
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
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 …
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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…

762 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