473,382 Members | 1,329 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,382 software developers and data experts.

Merging several lists into one, with different field names

I routinely have to qry several databases and combine the records for a
mailing list. In all of the tables the fiedl names are different. For
example: FName First name and FirstName

Right not I have append queries, 1 for each list I bring in, to append
to a main table. I would like to have one query or process that will
process assorted different lists and append the correct fields to the
main table.

I also have a qry for each list that cleans it up before appending to
the main table. Like one list won't have the name split into first and
last name, but another one does. One list routinely has customer name
in 2 fields (if it is a long name) but others it is all in one field.
Can anyone head me in the right direction for doing this?

Nov 13 '05 #1
2 1694
On 29 Jul 2005 07:03:54 -0700, te**********@hotmail.com wrote:
I routinely have to qry several databases and combine the records for a
mailing list. In all of the tables the fiedl names are different. For
example: FName First name and FirstName

Right not I have append queries, 1 for each list I bring in, to append
to a main table. I would like to have one query or process that will
process assorted different lists and append the correct fields to the
main table.

I also have a qry for each list that cleans it up before appending to
the main table. Like one list won't have the name split into first and
last name, but another one does. One list routinely has customer name
in 2 fields (if it is a long name) but others it is all in one field.
Can anyone head me in the right direction for doing this?


What you're describing is better thought of as a data transfer component, not
a database component.

I find that it's usually better to use code loops in these cases rather than
SQL. The problem is that any SQL-based model you try to use ends up getting
more and more complex overt time to handle all the different input cases,
eventually requiring complex and error-prone automated SQL generation to keep
from duplicating logic on all the queries and having to maintain it in
multiple places. When you're done, you have 2 or layers of logic to
separately debug, and you have something that can't always tell you anything
about where or why it failed when something goes wrong. It might be 20 to 50%
faster than the code loop, but who cares.

Using code loops, it's easier to adapt the code, and you can implement error
handers that can actually tell you something about what row and column caused
a problem when, say, the source field data is too wide for its target.

Nov 13 '05 #2

<te**********@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I routinely have to qry several databases and combine the records for a
mailing list. In all of the tables the fiedl names are different. For
example: FName First name and FirstName .... I also have a qry for each list that cleans it up before appending to
the main table. Like one list won't have the name split into first and
last name, but another one does. One list routinely has customer name
in 2 fields (if it is a long name) but others it is all in one field.


You can use a union query for a more dynamic result. Field names don't have
to match, but field order does.

Create new query with no tables. For each source query copy the SQL
statement (switch to SQL view, hightlight, and copy) and paste it into the
new blank query. Remove the trailing ";" and add the word Union between
each query. The final query will end with a ";"

Your query will look something like:

Select [FName], [LName] from tblA

Union

Select [First Name], [Last Name] from tblB;

Good luck!

Tim Mills-Groninger
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: Lasse Vågsæther Karlsen | last post by:
I need to merge several sources of values into one stream of values. All of the sources are sorted already and I need to retrieve the values from them all in sorted order. In other words: s1 = ...
2
by: Emmett Power | last post by:
Hi, I have an Access table with a number of records which refer to the same person but with data in different fields. So for example the table would look like this: Name..............Field...
5
by: Jerry Hull | last post by:
I'm working with a database developed by an untrained person over several years - and on a network that has recently been upgraded with a new server installed and MS office upgraded from 2K (I...
0
by: Naresh Narwani | last post by:
Problem Summary: Merging two different web applications into one create a problem for User Controls. Reason for merging two different Web Application: To share non serializable object...
12
by: google_groups3 | last post by:
Hi all. I currently have 2 text files which contain lists of file names. These text files are updated by my code. What I want to do is be able to merge these text files discarding the...
2
by: dpossen | last post by:
i am building a movie database in microsoft access. I have a field for actors last name and a field for actors first name as well as field for actors fullname. I want the full name field to...
1
by: keveen | last post by:
Can someone tell me how I can import tables from another non-Joomla mysql file into Joomla? Basically it is just from one mySQL database into another. I use phpMyAdmin to import and export the entire...
9
by: karenjfrancis | last post by:
I have 4 Access databases, all with the same data model but different data. I want to build a front end that brings all of the data in the 4 databases together into one. Assuming my table of...
14
by: etal | last post by:
Here's an algorithm question: How should I efficiently merge a collection of mostly similar lists, with different lengths and arbitrary contents, while eliminating duplicates and preserving order...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: 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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.