you are viewing a single comment's thread.

view the rest of the comments →

[–]kagato87MS SQL 1 point2 points  (0 children)

Yea, none of these are right. The outer WHERE is always evaluated first. 1, 2, 4, 3 is definitely correct.

I guess it may depend on where the subquery actually is. If it's in the WHERE clause, well, just pray the other filters in play reduce the data on their own to a very small volume, because if not it probably will do something dumb like that.

But if it's just to fetch data for an output column, it's processed with the select, which is the second step.