I have been looking at CROSS / OUTER APPLY
with a colleague and we're struggling to find real life examples of where to use them.
I've spent quite a lot of time looking at When should I use Cross Apply over Inner Join? and googling but the main (only) example seems pretty bizarre (using the rowcount from a table to determine how many rows to select from another table).
I thought this scenario may benefit from OUTER APPLY
:
Contacts Table (contains 1 record for each contact) Communication Entries Table (can contain n phone, fax, email fro each contact)
But using subqueries, common table expressions, OUTER JOIN
with RANK()
and OUTER APPLY
all seem to perform equally. I'm guessing this means the scenario isn't applicable to APPLY
.
Please share some real life examples and help explain the feature!
This question is related to
sql
sql-server
sql-server-2008
sql-server-2005
Source: Stackoverflow.com