Creating a UNION Query in Microsoft Access - Combine multiple datasets into one view

preview_player
Показать описание
I'm going to demonstrate how to create a UNION query in Microsoft Access, which will allow you to combine the data from multiple tables all into one view. This will allow you to do things like run counts on data from different tables, all in one place. In the example I provided, I had employee data from three different datasets that represent cities. By using a UNION query, I can make queries and reports with information from all datasets.

0:08 - Brief Explanation
0:36 - First example (combine 2 tables)
2:13 - Second example (combine 3 tables)
3:07 - A tip to distinguish each original table/data source in the UNION query

Finally, here is the SQL code I used in the MS Access Design Builder:

FROM chicagoteam

UNION

FROM phoenixteam

FROM houstonteam
ORDER BY [employee];
Рекомендации по теме
Комментарии
Автор

This is what I have been looking. Thank you!

DarmaSaputra-yb
Автор

Thank You!. I have two Access tables. How do I merge these tables which have identical structures and then get only unique records in a new access table?

RabiReels
Автор

thumbs up for another great tutorials. How to extract data from one table for the other table (different fields). I have table with hundreds of thoussands records. One table has all the names, the other table has thousands of missing names. Is there anyway to copy data from one table to the other? thanks a lot

Jojosmith
Автор

My query does not like one of my first fields with spaces in it, and that column is not in the other tables I am selecting. Perhaps I should be doing a join instead since columns and rows/records are mostly different?

threehanded
Автор

Can I use the union query and then insert the results into a new table?

thearter
Автор

I wasn't able to create the variable

HarveyPVP
welcome to shbcf.ru