If a query’s where conditions are connected by or, evaluation stops when any clause evaluates to TRUE, and the row is returned.
This query contains two or clauses in addition to the subquery:
select au_fname, au_lname, title from titles t, authors a, titleauthor ta where t.title_id = ta.title_id and a.au_id = ta.au_id and (advance > (select avg(advance) from titles t2 where t.type = t2.type) or title = "Best laid plans" or price > $100)
Adaptive Server orders the conditions in the query plan to evaluate the subquery last. If a row meets the condition of the or clause, Adaptive Server returns the row without executing the subquery, and proceeds to evaluate the next row. The maximum number of ORs in a query expression is1024.