473,385 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Unusual Merge Two Tables into one Query

Okay, this is not your normal two table query (at least it doesn't seem that way to me).

I'm using Access 2000 on Windows XP.

I have two tables in access. One is a table with addresses of club members and the other is a table with addresses of club houses. I want to merge the Addresses and Names in one long list.

For Example:
Table 1:
MemberName.....MemberAddress.....MemberClubhouse
Joe....................12345 Nowhere.......Clubhouse One
Mike..................23456 Nowhere.......Clubhouse Two
Steve.................34567 Nowhere.......Clubhouse Three
Diana.................45678 Nowhere.......Clubhouse One

Table 2:
ClubhouseName.....ClubhouseAddress
ClubhouseOne.......9876 Somewhere
ClubhouseTwo.......8765 Somewhere
ClubhouseThree.....7654 Somewhere

Now.... What I want is a query that returns this:
Name...................Address
Joe .......................12345 Nowhere
Mike......................23456 Nowhere
Steve.....................34567 Nowhere
Diana.....................45678 Nowhere
ClubhouseOne........9876 Somewhere
ClubhouseTwo........8765 Somewhere
ClubhouseThree......7654 Somewhere


This is for a mailing list where I would like to both mail the newsletter to the members and to the regional clubhouses where they are members at. I have the members and clubhouses in two separate tables for obvious reasons.

I honestly have no idea where to start with this problem. I could always have two separate queries and then copy and paste them together in Excel, but I'm trying to automate the process as much as possible (plus I would like it to be a one step process for when I hand the database to another user without computer skills).

I realize that this may be fairly complex, but if someone can point me in the right direction or to a starting point, I can probably figure it out myself.

Hopefully this is much easier than I think it is.

Thanks for your help in advance

- Marshall
Aug 1 '07 #1
4 9156
JKing
1,206 Expert 1GB
You can use a Union query,

Expand|Select|Wrap|Line Numbers
  1. SELECT memberName, memberAddress
  2. FROM Table1
  3. UNION
  4. SELECT clubhouseName, clubhouseAddress
  5. FROM Table2
  6.  
Aug 1 '07 #2
mlcampeau
296 Expert 100+
What if you were to append the two tables to a third table?
Aug 1 '07 #3
FishVal
2,653 Expert 2GB
Okay, this is not your normal two table query (at least it doesn't seem that way to me).

I'm using Access 2000 on Windows XP.

I have two tables in access. One is a table with addresses of club members and the other is a table with addresses of club houses. I want to merge the Addresses and Names in one long list.

For Example:
Table 1:
MemberName.....MemberAddress.....MemberClubhouse
Joe....................12345 Nowhere.......Clubhouse One
Mike..................23456 Nowhere.......Clubhouse Two
Steve.................34567 Nowhere.......Clubhouse Three
Diana.................45678 Nowhere.......Clubhouse One

Table 2:
ClubhouseName.....ClubhouseAddress
ClubhouseOne.......9876 Somewhere
ClubhouseTwo.......8765 Somewhere
ClubhouseThree.....7654 Somewhere

Now.... What I want is a query that returns this:
Name...................Address
Joe .......................12345 Nowhere
Mike......................23456 Nowhere
Steve.....................34567 Nowhere
Diana.....................45678 Nowhere
ClubhouseOne........9876 Somewhere
ClubhouseTwo........8765 Somewhere
ClubhouseThree......7654 Somewhere


This is for a mailing list where I would like to both mail the newsletter to the members and to the regional clubhouses where they are members at. I have the members and clubhouses in two separate tables for obvious reasons.

I honestly have no idea where to start with this problem. I could always have two separate queries and then copy and paste them together in Excel, but I'm trying to automate the process as much as possible (plus I would like it to be a one step process for when I hand the database to another user without computer skills).

I realize that this may be fairly complex, but if someone can point me in the right direction or to a starting point, I can probably figure it out myself.

Hopefully this is much easier than I think it is.

Thanks for your help in advance

- Marshall
Hi, Marshall.

The answer is very simple. SQL has UNION statement to merge records from multiple tables.
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM Table1 UNION SELECT * FROM Table2;
  2.  
Good luck.
Aug 1 '07 #4
Thank you! Thank you! Thank you!

I knew there was an easy way to do it.

All praise the UNION Query!!!!

Thanks again! Problem solved!
Aug 1 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: svdh2 | last post by:
I have been looking at a problem the entire week in access, I have still not been able to find a solution. Hope that you could maybe tell where to look Concerns the link between Access and Word....
1
by: Tom Keane | last post by:
Hi, I need some helpings again! I have a query from one of my tables that gets a total amount of money and gets a percentage from it ie, the field I create in the query is invGSTAmount from a...
8
by: Darryl Kerkeslager | last post by:
I hope that although this is 25% Access and 75% Word, that someone will know ... The whole problem here arises because 1) Microsoft acknowledges an 'issue' wherein TextInput type FormFields are...
3
by: cdelarte | last post by:
I would like to be able to mail merge records from multiple mysql tables using a simple template, preferably via a command line script. MSWord mail merge via ODBC will not work for me as it only...
16
by: UDBDBA | last post by:
Hi All: I need some clarification on a MERGE statement. The database is on V8 FP12 (AIX) 64bit. The source table is tableA. The target is a View "FACT" with UNION ALL because of the 512 Gig...
3
by: John Cosmas | last post by:
I have a DATATABLE which I have populated in my application, and I need it written out to a particular table I specify in my ACCESS database. My code works to the point of the MERGE and UPDATE,...
5
by: Mark Chambers | last post by:
Hi there, Can anyone explain the following (very) simple scenario. 1) I make an exact copy of my "DataSet" and delete one record from a given table (in the copy) 2) I invoke...
2
by: zazu | last post by:
We have a query which is used as a mail merge source in Word. No problem. However we made it a parameter query and when trying to establish the link between the query and the word document in the...
2
by: Scott | last post by:
Recently the table has been delete some records by mistakes. Now, I have a backup of about one-week old table and the latest table with some deleted records. I would like to merge these two...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.