Help on Append Query

S

Shirley

Hi,

I have two tables. The first table has about 22,000 rows and contains two
fields: (!) Asset ID and (2) Amount.

The second table has 33,000 rows and contains two fields (1) Asset ID and
(2) Asset Description.

How do I create one table or query that gives me (1) Asset ID, (2) Asset
Description and (3) Amount?
 
A

Allen Browne

So you have some AssetID values in table2 that have no matching value in
table1? And possibly some AssetID descriptions in table2 that have no
amounts in table1? And possibly some AssetID values that are repeated within
table1? And some that may be repeated within table2? And some where the
AssetID could be null?

Create a UNION query by selecting the unique, non-blank Asset ID values from
both tables:
SELECT [Asset ID]
FROM [table1]
WHERE [Asset ID] Is Not Null
UNION
SELECT [Asset ID]
FROM [table2]
WHERE [Asset ID] Is Not Null;

Save it as (say) Query1.

Now create another table, using that one as a source 'table' as well as the
other 2. Join Query1.[Asset ID] to Table1.[Asset ID]. Double-click the line
joining them. Access pops up a dialog offering 3 options.Choose the one that
says:
All records from Query1, and any matches from Table1.
(This is known as an outer join.)

Join Query1.[Asset ID] to Table2.[Asset ID].
Again make it an outer join.

If you see any line joining Table1 directly to Table2, delete that join.

The query will give you every unique Asset ID value, with any matching
amounts and descriptions from the other tables. If an Asset ID is repeated
within Table1 or Table2, it will have multiple rows in this query.

Results will be read-only.
It may take some time to run.
 

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

Top