When should I use cross apply over inner join?

前端 未结 14 1360
忘了有多久
忘了有多久 2020-11-22 06:51

What is the main purpose of using CROSS APPLY?

I have read (vaguely, through posts on the Internet) that cross apply can be more efficient when selectin

14条回答
  •  爱一瞬间的悲伤
    2020-11-22 07:17

    The essence of the APPLY operator is to allow correlation between left and right side of the operator in the FROM clause.

    In contrast to JOIN, the correlation between inputs is not allowed.

    Speaking about correlation in APPLY operator, I mean on the right hand side we can put:

    • a derived table - as a correlated subquery with an alias
    • a table valued function - a conceptual view with parameters, where the parameter can refer to the left side

    Both can return multiple columns and rows.

提交回复
热议问题