bidalah (AT) yahoo (DOT) com (Mike Cooper) wrote in message news:<df4443e2.0404042023.4cce3033 (AT) posting (DOT) google.com>...
Quote:
Hi,
I have a simple question. I have 5 different tables. I would like to
build a query that simple displays all of the data of all of the
tables without exception and without hitting a cartesian product. The
tables are all nearly identical with the exception of 1 or 2 columns.
Is this possible? |
Hello Mike,
Access has a type of query called a "Union" query. This is what
would be needed to get all records from all of your tables.
Just one thing, make sure all fields in all tables are the same.
Example: tbl01 - Field01: LongInteger, Field02: Text, Field03: Text.
tbl02 - Field01: LongInteger, Field02: Text, Field03: Text, etc.
If not, then you can make a temporary query that souces each table
for the fields you want to source. I do something similar when
making Union queries. I make a query that sources my table with
the required fields, go into the SQL view and copy the text.
Then I paste it into another query I have already started which
is in SQL view already. I repeat for each table I need to source
so that I don't have to type any thing and make mistakes.
When I paste the second query's data, I add Union All before the
Select statement.
Example:
SELECT Table01.RecordID, Table01.Field01, Table01.Field02, Table01.Field03
FROM Table01;
Union All SELECT Table02.RecordID, Table02.Field01, Table02.Field02,
Table02.Field03 FROM Table02;
Union All SELECT Table03.RecordID, Table03.Field01, Table03.Field02,
Table03.Field03 FROM Table03;
Etc.
I don't like typing any more than I have to.
Regards,
Ray