Oct 8, 2015

Difference between CROSS JOIN and CROSS APPLY in T-SQL

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.

No comments:

Post a Comment