Combining Query Results with SQL's UNION Statement
Sunday April 26, 2009
SQL’s UNION command allows you to combine the results of two or more database queries that are not necessarily linked through a database relationship. For example, imagine that you have a school database and wish to use it to create a master contact list for all students, faculty and staff. Looking at your database, you discover that the records corresponding to each of these constituencies appears in separate database tables.
Your first instinct might be to export the data from each table into a spreadsheet and combine the information there. However, you can combine these records within your database by writing separate queries for each constituency and combining the results of those queries with the UNION statement.
Read the full article: Combining Query Results with SQL's UNION Statement
Your first instinct might be to export the data from each table into a spreadsheet and combine the information there. However, you can combine these records within your database by writing separate queries for each constituency and combining the results of those queries with the UNION statement.
Read the full article: Combining Query Results with SQL's UNION Statement


Mike, excellent tutorial on Union Queries. It’s interesting to note also that Access doesn’t allow you to build Union Queries with the graphical query designer. If you don’t know SQL, you simply cannot create one.
Richard Rost
AccessLearningZone.com
How do we combine UNION with WHERE statement? I have more than 3 separate tables using UNION something like: $sql = $sql_a . ‘ UNION ALL ‘ . $sql_b . ‘ UNION ALL ‘ . $sql_c;
Tried using WHERE after this statement seem doesn’t work. is it possible?