Jeff Lindner

Greenhorn
+ Follow
since May 29, 2017
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jeff Lindner



1. The outer query is run first.  The outer query selects all orders, including orders that are not associated with a customer (e.g. orders fulfilled where buyer chose not to register as a customer).

2. Next, the subquery is run for each record selected in the outer query.

   - If the order has a customer, the subquery returns the balances of all accounts associated with the customer.  If all balances are < 10000 the ALL condition evaluates to TRUE and the row of the outer query is included in the result set.

   - If a subquery returns zero rows (which would happen in this example if if there is no customer associated with the order) the ALL condition evaluates to TRUE and the row is included in the result.

*The orders in the first query are not associated with customers and therefore the result set will include both orders that have customers and orders that were processed for people who decided not to register as customers.*


1.  The outer query is run first.  The outer query selects only orders that are associated with customers.

2.  Next, the subquery is run for each row.

   - If the customer associated with the order has one or more accounts and all of the account balances are< 10000 the ALL condition will evaluate to true and the row in the outer query is included in the result set.

   - If the customer associated with the order has no accounts the subquery returns zero rows the ALL condition evaluates to true and the row in the outer query is included in the result set.

*The orders in the second query are associated with customers and therefore the result set will not include orders that were processed for people who decided not to register as customers.*