Share via


How to: Create UNION Queries

The UNION keyword enables you to include the results of two SELECT statements in one resulting table. All rows returned from either SELECT statement are combined into the result of the UNION expression.

Note

The Diagram pane can only display one SELECT clause. Therefore, when you are working with a UNION query, Query Designer hides the Table Operations pane.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Customizing Development Settings in Visual Studio.

To create a Merged SELECT query

  1. Open a query or create a new one.

  2. In the SQL pane, type a valid UNION expression.

  3. On the Query Designer menu, click Execute SQL to run the query.

    Your UNION query is now formatted by Query Designer.

See Also

Concepts

Supported Query Types (Visual Database Tools)

Other Resources

Designing Queries and Views

Performing Basic Operations with Queries