Hi Friends,

In a multi-valued, self-conatined subquery, the inner query (also called as the inner select) returns multiple values. The outer query consumes and validates the list of values returned by the subquery using IN clause. Subqueries can also be nested. Here is an example:-

The innermost query returns the sales person IDs. The query at the next higher level is evaluated with these sales person IDs and returns the contact ID numbers of the employees. Finally, the outer query uses the contact IDs to find the names of the employees.

The above query can also be written as a join:

So friends, what about performance? Run both the queries as a batch and see the relative costs. Which one you think performs better? Comments?