You can also add a subquery to SELECT, WHERE, HAVING clauses in SQL
queries. The following display shows how a subquery can be added as
a condition to a WHERE clause.
Add a Subquery to a WHERE Clause
Note that the subquery
is connected to the WHERE clause with the EXISTS operator, which you
can select from the drop-down menu in the
Operator field.
To add the subquery, click in the
Operand field
on the right-hand side of the
Where tab.
Then, click
Subquery from the drop-down menu.
The following display shows the completed sample subquery.
Sample WHERE Clause Subquery
The subquery includes
a source table, a SELECT clause, and a WHERE clause. You can compare
the tree view of the subquery in the Navigate pane to the process
flow on the
Diagram tab and the code that
is highlighted on the
Code tab.