MASTER TABLE
x------x--------------------x
| Id | Name |
x------x--------------------x
| 1 | A |
| 2
In your example queries the results are indeed the same.
But OUTER APPLY
can do more: For each outer row you can produce an arbitrary inner result set. For example you can join the TOP 1 ORDER BY ...
row. A LEFT JOIN
can't do that.
The computation of the inner result set can reference outer columns (like your example did).
OUTER APPLY
is strictly more powerful than LEFT JOIN
. This is easy to see because each LEFT JOIN
can be rewritten to an OUTER APPLY
just like you did. It's syntax is more verbose, though.