BackPrevious Page Next PageNext

Creating Union Queries

The Menu > Query > Union option of the Query Editor enables you to combine specified records from more than one query into a result set. Unlike a Join which creates one record with multiple columns from the 2 queries, the Union appends the results of one query to the results of the second query so the number of records is the sum of the two queries. You must match each column of the first query to the second query with the same number of columns, the same SQL types, and the same sequence of columns. The names do not need to match.

A common usage is to build a mash-up query that combines a query from one instance of a database to a second instance of the database. For example you want all the records for table Customers from one database appended to all the records from table Customers from a second database. The two Customers tables must match exactly the number of columns, the SQL type and sequence.

To create a union query:

  1. In the Catalog Manager, right-click a selected query (here we call it primary query) and select Edit Query to open the Query Editor.
  2. In the Query Editor, click Menu > Query > Union > New.
  3. In the Enter Query Name dialog, specify a name for the query and click OK.
  4. A new Query Editor is displayed. Create the query as required.

Notes:

After union queries are created, you can also manage them as follows:

  1. In the Catalog Manager, right-click the primary query and select Edit Query.
  2. In the Query Editor, click Menu > Query > Union > Select. The Union dialog appears.

    Union dialog

  3. To add a union to the query, select a union in the Queries box and click Add button. To remove a union from the query, select it in the Union box, and then click Remove button.
  4. In the Union box, click the Attribute column to specify the type of the union.
  5. When done, click OK to confirm the changes.

BackPrevious Page Next PageNext