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

x
?
Solved

How to query two tables and merge the results?

Posted on 2004-11-01
5
Medium Priority
?
232 Views
Last Modified: 2013-12-24
I have two tables in Access, table A and table B.  I want to query both tables, find the like records and unlike records, and then display the results in Excel.  If the record exists in both tables, I only want to show the record from table A.

Can someone provide a code example for me to go by?
0
Comment
Question by:g118481
[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
5 Comments
 
LVL 21

Expert Comment

by:pinaldave
ID: 12464691
Hi g118481,
 
you should post this question in mssql area they will be able to give you quick reply.

Regards,
---Pinal
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 12464722
Actually you should post in the Accesss area - not MySql - and you need to post more information such as what do the tables look like?  What is the filed that they have in common that you want to compare.  DO you want to compare just existance of a single field or differences accross records?
0
 
LVL 1

Author Comment

by:g118481
ID: 12465765
MySQL and Access forums would not be able to help with how and where to us CFLOOP nor any CF conditional statements for this request.

I want to query table A and table B, find the like records in both and the records that are not alike, but only display the like records for table A and display the records that are not alike.  So, if a record exist in table B, but not in table B, then display it.  If a record exist in table A and table B, the display the record in table A, but not the record in table B.

Both tables have like named fields.  Here are the field names:
id
codenumber
codephase
codetotal
codeactuals
codemonth
codeid
codesubline
icodenumber
codepace


0
 
LVL 35

Accepted Solution

by:
mrichmon earned 400 total points
ID: 12466033
Yes, but once you have the queries that pull what you want you can easily display them.

Do you want to compare just existance of a single field or differences accross records?

Try something like this and see if it is waht you want....


SELECT *
FROM table1 t1
LEFT OUTER JOIN table2 t2
ON t1.id = t2.id
t2.id IS NULL

this will pull all records that are in table 1 that  are NOT in table 2.  It works in SQL, but may need a bit of modification depending on the version of access....
0

Featured Post

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

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

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

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