Joining four identical tables to create a new table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have four identical tables (same structure, but different data) that I need
to consolidate into a new (i.e., fifth) table. Can someone point me in the
right direction as to how to set up a query (and join properties) to do this?
Thanks in advance for any help.
Bob
 
Just build an append query and copy all the records from table four into
table one. Then do the same to move all the records from table three to
table one, then repeat for table two. Then, delete table two, three, and
four.
 
Note....

I would make a backup copy of the database before doing the queries
indicated in my last post.
 
Rick,
I apologize for not being more clear in my original post. I was hoping to
do some form of join among the four tables so that I could accomplish the
"consolidation" with just one query. Is that possible, or must I create the
four queries you mentioned below?
Thanks again,
Bob
 
Rick,
I apologize for not being more clear in my original post. I was hoping to
do some form of join among the four tables so that I could accomplish the
"consolidation" with just one query. Is that possible, or must I create the
four queries you mentioned below?
Thanks again,
Bob
 
Rick,

I apologize for not being more clear in my original post. I was hoping to
do some form of join among the four tables so that I could accomplish the
"consolidation" with just one query. Is that possible, or must I create the
four queries you mentioned below?

You should also know that users access the four tables in order to
add/delete/change rows. Hence, the reason for having a fifth table to serve
as the "Summary" (i.e., consolidation) of the other four tables.

Thanks again,
Bob
 
You will create one query, run it, then change it, run it again, etc.
Whether one query or four, this is a one step process to get your data into
one normalized table. Why does it matter if it takes one query run or four?
 
What do you mean the users access all four tables? If the tables are
identical database normalization rules would dictate that they would all be
in one table.

If users want to see a subset of the data (all of Jon's records, or all the
"big" clients) then you would use a query to limit the records displayed
based on a "owner" field or a "priority" field.

Don't maintain 4 identical tables. It is wrong. Normalize your data and
then you will have much less trouble going forward. If users want to access
a portion of the tables, build them each a query that pulls out only their
desired records.
 
One more thought. If you want to pull records from multiple tables to one
Query, you can do so by creating a UNION query. You would not save the
results to yet another table. That would further unnormalize your data.

Anything you can do with a table can also be done with a query.

Just curious, how are you creating forms, queries, and reports since you
have four tables? Are you having to create four reports each time, four
forms, four queries, etc? That is why you normalize. If you normalize,
then you can create ONE report, and ask the user to pick the "type" of data
to include.

You'd have to let us know what makes the four tables different.

If one table is "widget" vendors, and one is "gizmo" vendors, and one is
"thingamajig" vendors, then you need to have one table with a new "Product"
field. In the "Product" field you'd select "widget, gizmo, or thingamajig
for each vendor. Then, when you open a form, you can select from a
drop-down that you only want to see "widget" vendors. When you run reports,
you can tell it what kind of vendors you want.

When you build the append queries I mentioned, you need to have that
"Product" table built first. In the "widget" table, update the Product
field for all the records to "widget". In the gizmo table, update the
Product field for all the records to "gizmo", then build your append queries
to move all the records to the new consolidated tables (including the
product field). Once you have done all that, you can delete the other four
tables.

This is true if you have separate tables for each "representative" or a
separate table for each "office" or a separate table for each "company",
etc. In short, you do not need multiple identical tables.

Hope that helps, as I am heading out for the day.
 
Rick,
The reason for the four tables is for security purposes. The four tables
are updated daily by people who have access only to a specific table. I
realize that this violates normalization rules, but I didn't know any other
way (at the time) to implement the necessary security requirements.
I assume I can implement your suggestion to create a SELECT query that will
still allow only specific users to edit the records that they are allowed to
edit. True?
Thanks again for all your help. I greatly appreciate it.
Bob
 
Yes, you can (and should) take away all access to the tables. You can then
create queries to which each user has access. I believe you will have to
mark the queries as "run with owner permission" so they can read the tables
and perform the updates even though the user does not have access to the
tables.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top