SQL Theory: Difference CROSS JOIN Vs CROSS APPLY

A CROSS JOIN will always join (combine) every row in table 1 with every row in table 2.  You can’t specify a condition on a cross join, even if you want to.

CROSS APPLY will join every row in table 1 with only rows with matching column values in table 2.  But, if you don’t specify any columns to do the matching on, every row automatically matches, which causes CROSS APPLY to produce the same result as a CROSS JOIN.

Advertisements