Report Studio
Create a union query to combine two or more queries into
one result set.
To combine two queries, the following conditions must be
met:
- The two queries must
have the same number of data items.
- The data types of
the data items must be compatible and the data items must appear in the
same order.
- For numeric data types, integer, float, double, and decimal are compatible.
- For string data types, char, varChar, and longVarChar are compatible.
- For binary data types, binary and varBinary are compatible.
- Date data types must match perfectly.
To create a query union:
- Pause the pointer over
the query explorer button
and click Queries.
- In the Insertable
Objects pane, do the following:
- Drag Query to the work area.
- Drag Union, Intersect,
or Except to the right of the
query.
Two drop zones appear to the right of the operator.
- Drag a Query object to each drop zone.
Two queries are created in the work area and a shortcut
to each query appears in the drop zones.
- Double-click each query
that makes up the union query and add the data items that you want.
- On the toolbar, press the
back button to return to the Queries work area.
- Click the set operator
that you added in step 3.
- In the Properties
pane, click the Duplicates property
and choose whether you want to remove or preserve duplicate rows.
- Double-click the Projection List property.
The projection list shows the list of projected data items for the
set operation.
- If you want Report
Studio to automatically produce the list of projected data items, click
Automatically generated.
Report Studio generates the projection list using only one
of the two queries being unioned.
- To add, delete, move, or
rename data items in the projection list, click Manual
and make the changes you want.
- Double-click the union
query.
- In the Insertable
Objects pane, on the source tab
, drag the data items
that you want to add to the query to the Data
Items pane.
The union query is complete. You can now link it to a data
container in the layout.
Related Topics: