MAKE TABLE QUERY

jo.stanley

Board Regular
Joined
Apr 13, 2004
Messages
177
I have two tables in a database, one holds 26,000 rows of data and the other holds 1,000. I want to run a make a table query by seraching for the data in the larger table that matchs the smaller table.

i.e. smaller table contains email addresses and i would like to extract the data from the larger table that have matching email addresses and put this data in a new table . Can you help with what I would need to do in the query. I have only ever run simple queries.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
You should be able to do it the same as a simple query.
create a new query with the two tables in it. Join the tables by the Email field.
The goto Query>Make Table Query... and give a name for the table.
Hit the Exclamation mark on the toolbar to run it and make the table.

HTH

Peter
 
Upvote 0
Start off by making a normal (select) query that gives you the correct result.

Go to design view and add the two tables.

Drag the field in the small table containing the e-mails on to the corresponding field in the large table.

Double click on the join between the two tables and chose
show all from small table and only those that match from larger table.

Now add the fields you want from the larger table.

Then goto Datasheet view and see if you are getting the result you want.

Then return to design view and goto Query>Make-Table Query...

You will then be prompted for the name for the new table.

Next save the query with a suitable name.

You can now run the query by double-clicking it.

To alter the query right click and goto Design.

The SQL for the Select Query would look something like this:

SELECT [Large Table].Email, [Large Table].Field1, [Large Table].Field2, [Large Table].Field3, [Large Table].Field4, [Large Table].Field5, [Large Table].Field6
FROM [Large Table] RIGHT JOIN [Small Table] ON [Large Table].Email = [Small Table].Email;

and for the Nake-Table Query

SELECT [Large Table].Email, [Large Table].Field1, [Large Table].Field2, [Large Table].Field3, [Large Table].Field4, [Large Table].Field5, [Large Table].Field6 INTO [Make New Table]
FROM [Large Table] RIGHT JOIN [Small Table] ON [Large Table].Email = [Small Table].Email;
 
Upvote 0
Jo,

Go into Queries. You want a new query. Probably best in design view.

Now add the two table you need then close the popup.

You'll need to link the common field together for the tables e.g reference <-> reference .. simply drag from one to the other with your left mouse button.

Hold down the CTRL key and select the fields you want to see on the output (from which you'll make a table). When all highlighted drag them with left mouse button into first empty box below. Repeat for the other table (you might only want email address from 2nd one).

Now select the "Query" menu and choose "Make Table". Give the table a name and choose the database to put it in.

Now if you run your query the table will be created. It will overwrite each time you run it. If you just want to see the records first, change it back to a "select" query, then back to "make table" when you are happy with the results.

Hope this helps... :wink:

Gary. :rolleyes:
 
Upvote 0

Forum statistics

Threads
1,221,777
Messages
6,161,871
Members
451,727
Latest member
tyedye4

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top