In this tutorial you will create a subquery to use to filter your selection of address IDs to only those addresses from specific regions.
To build a subquery
Connect to the Toad Sample (Access) database in the Navigation Manager.
Click these column names in the ADDRESS table to add the columns to the query:
Select the Where field in the REGION_ID column and click . The Where Condition editor displays.
Select the IN operator from the list, and then click Subquery.
A child Query Builder window displays for you to use to build the subquery.
The child (subquery) Query Builder window includes a Diagram pane, a Criteria pane, and a Queries pane for navigating back and forth between subqueries and the main query.
Drag the REGION table to the Diagram pane and select the REGION_ID column.
Select the Where field in the REGION_ID column and click . In the Where Condition editor, select the In comparison operator, select Constant, and select the values 1 and 2.
Your subquery window should look something like this:
Click the Query node in the Queries pane to return to the main query window. A call-out in the main query Diagram pane indicates that the statement contains a subquery and identifies the column it is on. Hover over the call-out to view the subquery statement.