Creating a Union

A union is a set of SELECT statements pasted together with a UNION clause. The union returns the combined result sets from both queries. You can use SQLWizard to help you build a union .

Note:

SQLWizard allows you to combine up to approximately 33 query results using the UNION operator (the maximum number will depend upon the complexity of your query). You must make certain when writing these queries that the data types of the columns in the SELECT clause match.

To create a union:

  1. Create the first query using the Query Design window.
  2. Create the second query using another Query Design window. Make certain that there is a one-to-one correspondence between the columns in each SELECT clause.
  3. Now switch to SQL view by clicking on the SQL button on the toolbar.
  4. Copy the SELECT statement to the clipboard by selecting it and then clicking the Copy command from the Edit menu.
  5. Click the other Query Design window, and switch it to the SQL view.
  6. Go to the end of the second SELECT statement and type the keyword UNION.
  7. Now paste the query from the clipboard after the UNION keyword to complete the union. You are ready to save or run.
Note:

When you save, you must save from the SQL view because UNION is not supported by the Query Design window. When you save the query, you will be warned that you will lose your prompted SQL changes.