Create a merged query from two queries

  1. From Analysis, click Information library. The information library appears.

  2. On the Queries tab, click the double arrows beside one of the queries you want to use to expand the options and click Merge. The New Ad-hoc Query screen appears.

  3. The first query appears in the Query A field. In the Query B field, search for and select the query you want to merge with query A.

    Note: You can only merge queries from the same source view. For information about source views, refer to Source Views.

  4. For Include records that are in, click the merge option to use. Under Description, an explanation of the records included in the selected option appears.

  5. In the Selection name field, enter the name to appear for the selection of records the program automatically creates for the merged results. By default, the selection is active and available in the Selections folder of the source view query screen. To edit the selection properties, open it from the Selections page of the information library.

  6. To select output fields, click the Select output fields tab. 

  7. Under Browse for fields in, you can view the types of fields that are available for the query source view the queries use. You can expand a node to drill-down to a specific group of fields.

    Tip: To quickly search for a field, enter the field name in Find field and press ENTER on your keyboard. The program displays applicable fields in the middle pane. Use your arrows to browse through the list. If you select a group and click Search up, the search applies only to fields in the selected node.

    The middle pane lists the Fields and System fields for the selected group.

  8. To specify output fields for the query, select them in the middle pane and drag them into Result fields to display. Selected fields correspond to the information you want to view in the query results and they appear as column headings in the query output.

    Note: The output fields from each of the queries you selected automatically appear under Result fields to display. You can remove these fields from the output as necessary.

  9. To specify a sort order for the query results or filter on aggregate values, select the Set sort order for rows tab.

  10. Under Select results fields for sorting or group filters, the output fields selected on the Select output fields tab appear. Select the fields to sort by and drag them under Sort records by.

  11. Under Sort records by, include the fields to sort by and select whether to sort in ascending or descending order. Sort fields are optional. For example, to create a query to list the name and home telephone number of individuals, you can select an ascending sorting order by last name of the individual.

  12. To browse the query results, select the Preview results tab.

    This tab displays the first 500 rows of the query results so you can quickly browse the records and ensure they are correct.

  13. Adjust your settings on the other tabs as necessary. Otherwise, select the Set save options tab to specify the properties of the query.

  14. Enter a unique name and description to help identify the query.

  15. Specify the properties of the query as necessary. For information about the items on this tab, refer to Query Properties.

  16. Click Save to save your query and view the results.

 

 

You are here: Overview > Need Help with Analysis? > Information Library > Ad-Hoc Queries > Merge Two Queries > Create a merged query from two queries